You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2018/01/27 02:01:47 UTC

svn commit: r1822366 - in /httpd/httpd/trunk/server: Makefile.in mpm/event/event.c mpm/worker/worker.c mpm_fdqueue.c mpm_fdqueue.h

Author: ylavic
Date: Sat Jan 27 02:01:47 2018
New Revision: 1822366

URL: http://svn.apache.org/viewvc?rev=1822366&view=rev
Log:
mpm_fdqueue: follow up to r1821624.

Export ap_queue_*() fonctions, so that they are accessible from MPMs, but
don't provide "mpm_fdqueue.h" in the API (include/).


Modified:
    httpd/httpd/trunk/server/Makefile.in
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm/worker/worker.c
    httpd/httpd/trunk/server/mpm_fdqueue.c
    httpd/httpd/trunk/server/mpm_fdqueue.h

Modified: httpd/httpd/trunk/server/Makefile.in
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/Makefile.in?rev=1822366&r1=1822365&r2=1822366&view=diff
==============================================================================
--- httpd/httpd/trunk/server/Makefile.in (original)
+++ httpd/httpd/trunk/server/Makefile.in Sat Jan 27 02:01:47 2018
@@ -68,6 +68,7 @@ export_files:
 	( for dir in $(EXPORT_DIRS); do \
 	      ls $$dir/*.h ; \
 	  done; \
+	  echo "$(top_srcdir)/server/mpm_fdqueue.h"; \
 	  for dir in $(EXPORT_DIRS_APR); do \
 	      ls $$dir/ap[ru].h $$dir/ap[ru]_*.h 2>/dev/null; \
 	  done; \

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1822366&r1=1822365&r2=1822366&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Sat Jan 27 02:01:47 2018
@@ -845,7 +845,7 @@ static int start_lingering_close_blockin
     if (ap_start_lingering_close(cs->c)) {
         notify_suspend(cs);
         apr_socket_close(csd);
-        ap_push_pool(worker_queue_info, cs->p);
+        ap_queue_info_push_pool(worker_queue_info, cs->p);
         return 0;
     }
 
@@ -888,7 +888,7 @@ static int start_lingering_close_blockin
         ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, APLOGNO(03092)
                      "start_lingering_close: apr_pollset_add failure");
         apr_socket_close(cs->pfd.desc.s);
-        ap_push_pool(worker_queue_info, cs->p);
+        ap_queue_info_push_pool(worker_queue_info, cs->p);
         return 0;
     }
     apr_thread_mutex_unlock(timeout_mutex);
@@ -929,7 +929,7 @@ static int stop_lingering_close(event_co
     ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, ap_server_conf,
                  "socket reached timeout in lingering-close state");
     abort_socket_nonblocking(csd);
-    ap_push_pool(worker_queue_info, cs->p);
+    ap_queue_info_push_pool(worker_queue_info, cs->p);
     if (dying)
         ap_queue_interrupt_one(worker_queue);
     return 0;
@@ -1020,7 +1020,7 @@ static void process_socket(apr_thread_t
         c = ap_run_create_connection(p, ap_server_conf, sock,
                                      conn_id, cs->sbh, cs->bucket_alloc);
         if (!c) {
-            ap_push_pool(worker_queue_info, p);
+            ap_queue_info_push_pool(worker_queue_info, p);
             return;
         }
         apr_atomic_inc32(&connection_count);
@@ -1177,7 +1177,7 @@ read_request:
                              "process_socket: apr_pollset_add failure for "
                              "write completion");
                 apr_socket_close(cs->pfd.desc.s);
-                ap_push_pool(worker_queue_info, cs->p);
+                ap_queue_info_push_pool(worker_queue_info, cs->p);
             }
             else {
                 apr_thread_mutex_unlock(timeout_mutex);
@@ -1228,7 +1228,7 @@ read_request:
                          "process_socket: apr_pollset_add failure for "
                          "keep alive");
             apr_socket_close(cs->pfd.desc.s);
-            ap_push_pool(worker_queue_info, cs->p);
+            ap_queue_info_push_pool(worker_queue_info, cs->p);
             return;
         }
         apr_thread_mutex_unlock(timeout_mutex);
@@ -1300,7 +1300,7 @@ static void close_listeners(int *closed)
         /* wake up the main thread */
         kill(ap_my_pid, SIGTERM);
 
-        ap_free_idle_pools(worker_queue_info);
+        ap_queue_info_free_idle_pools(worker_queue_info);
         ap_queue_interrupt_all(worker_queue);
     }
 }
@@ -1428,7 +1428,7 @@ static apr_status_t push2worker(event_co
             abort_socket_nonblocking(csd);
         }
         if (ptrans) {
-            ap_push_pool(worker_queue_info, ptrans);
+            ap_queue_info_push_pool(worker_queue_info, ptrans);
         }
         signal_threads(ST_GRACEFUL);
     }
@@ -1687,7 +1687,7 @@ static void process_lingering_close(even
     rv = apr_socket_close(csd);
     AP_DEBUG_ASSERT(rv == APR_SUCCESS);
 
-    ap_push_pool(worker_queue_info, cs->p);
+    ap_queue_info_push_pool(worker_queue_info, cs->p);
     if (dying)
         ap_queue_interrupt_one(worker_queue);
 }
@@ -2049,7 +2049,7 @@ static void * APR_THREAD_FUNC listener_t
                     void *csd = NULL;
                     ap_listen_rec *lr = (ap_listen_rec *) pt->baton;
                     apr_pool_t *ptrans;         /* Pool for per-transaction stuff */
-                    ap_pop_pool(&ptrans, worker_queue_info);
+                    ap_queue_info_pop_pool(worker_queue_info, &ptrans);
 
                     if (ptrans == NULL) {
                         /* create a new transaction pool for each accepted socket */
@@ -2104,7 +2104,7 @@ static void * APR_THREAD_FUNC listener_t
                         }
                     }
                     else {
-                        ap_push_pool(worker_queue_info, ptrans);
+                        ap_queue_info_push_pool(worker_queue_info, ptrans);
                     }
                 }
             }               /* if:else on pt->type */

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1822366&r1=1822365&r2=1822366&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Sat Jan 27 02:01:47 2018
@@ -676,7 +676,7 @@ static void * APR_THREAD_FUNC listener_t
 
         if (!listener_may_exit) {
             /* the following pops a recycled ptrans pool off a stack */
-            ap_pop_pool(&ptrans, worker_queue_info);
+            ap_queue_info_pop_pool(worker_queue_info, &ptrans);
             if (ptrans == NULL) {
                 /* we can't use a recycled transaction pool this time.
                  * create a new transaction pool */
@@ -743,7 +743,7 @@ static void * APR_THREAD_FUNC listener_t
     }
 
     ap_close_listeners_ex(my_bucket->listeners);
-    ap_free_idle_pools(worker_queue_info);
+    ap_queue_info_free_idle_pools(worker_queue_info);
     ap_queue_term(worker_queue);
     dying = 1;
     ap_scoreboard_image->parent[process_slot].quiescing = 1;

Modified: httpd/httpd/trunk/server/mpm_fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_fdqueue.c?rev=1822366&r1=1822365&r2=1822366&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm_fdqueue.c Sat Jan 27 02:01:47 2018
@@ -107,7 +107,7 @@ apr_status_t ap_queue_info_set_idle(fd_q
 {
     apr_status_t rv;
 
-    ap_push_pool(queue_info, pool_to_recycle);
+    ap_queue_info_push_pool(queue_info, pool_to_recycle);
 
     /* If other threads are waiting on a worker, wake one up */
     if (apr_atomic_inc32(&queue_info->idlers) < zero_pt) {
@@ -214,7 +214,7 @@ apr_uint32_t ap_queue_info_num_idlers(fd
     return (val > zero_pt) ? val - zero_pt : 0;
 }
 
-void ap_push_pool(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle)
+void ap_queue_info_push_pool(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle)
 {
     struct recycled_pool *new_recycle;
     /* If we have been given a pool to recycle, atomically link
@@ -249,7 +249,8 @@ void ap_push_pool(fd_queue_info_t *queue
     }
 }
 
-void ap_pop_pool(apr_pool_t **recycled_pool, fd_queue_info_t *queue_info)
+void ap_queue_info_pop_pool(fd_queue_info_t *queue_info,
+                            apr_pool_t **recycled_pool)
 {
     /* Atomically pop a pool from the recycled list */
 
@@ -279,13 +280,13 @@ void ap_pop_pool(apr_pool_t **recycled_p
     }
 }
 
-void ap_free_idle_pools(fd_queue_info_t *queue_info)
+void ap_queue_info_free_idle_pools(fd_queue_info_t *queue_info)
 {
     apr_pool_t *p;
 
     queue_info->max_recycled_pools = 0;
     for (;;) {
-        ap_pop_pool(&p, queue_info);
+        ap_queue_info_pop_pool(queue_info, &p);
         if (p == NULL)
             break;
         apr_pool_destroy(p);

Modified: httpd/httpd/trunk/server/mpm_fdqueue.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_fdqueue.h?rev=1822366&r1=1822365&r2=1822366&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_fdqueue.h (original)
+++ httpd/httpd/trunk/server/mpm_fdqueue.h Sat Jan 27 02:01:47 2018
@@ -45,18 +45,22 @@ struct fd_queue_elem_t; /* opaque */
 typedef struct fd_queue_info_t fd_queue_info_t;
 typedef struct fd_queue_elem_t fd_queue_elem_t;
 
-apr_status_t ap_queue_info_create(fd_queue_info_t **queue_info,
-                                  apr_pool_t *pool, int max_idlers,
-                                  int max_recycled_pools);
-apr_status_t ap_queue_info_set_idle(fd_queue_info_t *queue_info,
-                                    apr_pool_t *pool_to_recycle);
-apr_status_t ap_queue_info_try_get_idler(fd_queue_info_t *queue_info);
-apr_status_t ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info,
-                                          int *had_to_block);
-apr_uint32_t ap_queue_info_num_idlers(fd_queue_info_t *queue_info);
-apr_status_t ap_queue_info_term(fd_queue_info_t *queue_info);
-
-typedef struct timer_event_t timer_event_t;
+AP_DECLARE(apr_status_t) ap_queue_info_create(fd_queue_info_t **queue_info,
+                                              apr_pool_t *pool, int max_idlers,
+                                              int max_recycled_pools);
+AP_DECLARE(apr_status_t) ap_queue_info_set_idle(fd_queue_info_t *queue_info,
+                                                apr_pool_t *pool_to_recycle);
+AP_DECLARE(apr_status_t) ap_queue_info_try_get_idler(fd_queue_info_t *queue_info);
+AP_DECLARE(apr_status_t) ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info,
+                                                      int *had_to_block);
+AP_DECLARE(apr_uint32_t) ap_queue_info_num_idlers(fd_queue_info_t *queue_info);
+AP_DECLARE(apr_status_t) ap_queue_info_term(fd_queue_info_t *queue_info);
+
+AP_DECLARE(void) ap_queue_info_pop_pool(fd_queue_info_t *queue_info,
+                                        apr_pool_t **recycled_pool);
+AP_DECLARE(void) ap_queue_info_push_pool(fd_queue_info_t *queue_info,
+                                         apr_pool_t *pool_to_recycle);
+AP_DECLARE(void) ap_queue_info_free_idle_pools(fd_queue_info_t *queue_info);
 
 struct timer_event_t
 {
@@ -67,6 +71,7 @@ struct timer_event_t
     int canceled;
     apr_array_header_t *remove;
 };
+typedef struct timer_event_t timer_event_t;
 
 struct fd_queue_t
 {
@@ -82,23 +87,22 @@ struct fd_queue_t
 };
 typedef struct fd_queue_t fd_queue_t;
 
-void ap_pop_pool(apr_pool_t **recycled_pool, fd_queue_info_t *queue_info);
-void ap_push_pool(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle);
-void ap_free_idle_pools(fd_queue_info_t *queue_info);
-
-apr_status_t ap_queue_create(fd_queue_t **pqueue, int capacity, apr_pool_t *p);
-apr_status_t ap_queue_push_socket(fd_queue_t *queue,
-                                  apr_socket_t *sd, void *sd_baton,
-                                  apr_pool_t *p);
-apr_status_t ap_queue_push_timer(fd_queue_t *queue, timer_event_t *te);
-apr_status_t ap_queue_pop_something(fd_queue_t *queue,
-                                    apr_socket_t **sd, void **sd_baton,
-                                    apr_pool_t **p, timer_event_t **te);
-#define      ap_queue_pop_socket(q_, s_, p_) \
-                ap_queue_pop_something((q_), (s_), NULL, (p_), NULL)
-apr_status_t ap_queue_interrupt_all(fd_queue_t *queue);
-apr_status_t ap_queue_interrupt_one(fd_queue_t *queue);
-apr_status_t ap_queue_term(fd_queue_t *queue);
+AP_DECLARE(apr_status_t) ap_queue_create(fd_queue_t **pqueue,
+                                         int capacity, apr_pool_t *p);
+AP_DECLARE(apr_status_t) ap_queue_push_socket(fd_queue_t *queue,
+                                              apr_socket_t *sd, void *sd_baton,
+                                              apr_pool_t *p);
+AP_DECLARE(apr_status_t) ap_queue_push_timer(fd_queue_t *queue,
+                                             timer_event_t *te);
+AP_DECLARE(apr_status_t) ap_queue_pop_something(fd_queue_t *queue,
+                                                apr_socket_t **sd, void **sd_baton,
+                                                apr_pool_t **p, timer_event_t **te);
+#define                  ap_queue_pop_socket(q_, s_, p_) \
+                            ap_queue_pop_something((q_), (s_), NULL, (p_), NULL)
+
+AP_DECLARE(apr_status_t) ap_queue_interrupt_all(fd_queue_t *queue);
+AP_DECLARE(apr_status_t) ap_queue_interrupt_one(fd_queue_t *queue);
+AP_DECLARE(apr_status_t) ap_queue_term(fd_queue_t *queue);
 
 #endif /* APR_HAS_THREADS */