]> granicus.if.org Git - apache/commitdiff
mpm_unix: Follow up to r1821526.
authorYann Ylavic <ylavic@apache.org>
Fri, 19 Jan 2018 09:39:29 +0000 (09:39 +0000)
committerYann Ylavic <ylavic@apache.org>
Fri, 19 Jan 2018 09:39:29 +0000 (09:39 +0000)
Prepare mpm_worker to use common fdqueue.

[Reverted by r1821619]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821607 13f79535-47bb-0310-9956-ffa450edef68

server/mpm_unix.c
server/mpm_unix.h

index 5a2f132a4a205fe7ae8581d6adb107541b0b46d2..b76febece08701474a1cae840e6ce0aaca6964c0 100644 (file)
@@ -1274,7 +1274,9 @@ apr_status_t ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info,
          *     threads are waiting on an idle worker.
          */
         if (queue_info->idlers < zero_pt) {
-            *had_to_block = 1;
+            if (had_to_block) {
+                *had_to_block = 1;
+            }
             rv = apr_thread_cond_wait(queue_info->wait_for_idler,
                                       queue_info->idlers_mutex);
             if (rv != APR_SUCCESS) {
@@ -1536,6 +1538,7 @@ apr_status_t ap_queue_pop_something(fd_queue_t *queue, apr_socket_t **sd,
                                     timer_event_t **te_out)
 {
     fd_queue_elem_t *elem;
+    timer_event_t *te;
     apr_status_t rv;
 
     if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
@@ -1562,20 +1565,24 @@ apr_status_t ap_queue_pop_something(fd_queue_t *queue, apr_socket_t **sd,
         }
     }
 
-    *te_out = NULL;
-
-    if (!APR_RING_EMPTY(&queue->timers, timer_event_t, link)) {
-        *te_out = APR_RING_FIRST(&queue->timers);
-        APR_RING_REMOVE(*te_out, link);
+    te = NULL;
+    if (te_out) {
+        if (!APR_RING_EMPTY(&queue->timers, timer_event_t, link)) {
+            te = APR_RING_FIRST(&queue->timers);
+            APR_RING_REMOVE(te, link);
+        }
+        *te_out = te;
     }
-    else {
+    if (!te) {
         elem = &queue->data[queue->out];
         queue->out++;
         if (queue->out >= queue->bounds)
             queue->out -= queue->bounds;
         queue->nelts--;
         *sd = elem->sd;
-        *baton = elem->baton;
+        if (baton) {
+            *baton = elem->baton;
+        }
         *p = elem->p;
 #ifdef AP_DEBUG
         elem->sd = NULL;
index e541c35bf1f7a6d92628e8410c8219bfa92d896e..13c4aceaa21edc3ba355f66055dd7931ebed72be 100644 (file)
@@ -91,6 +91,8 @@ 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 **baton, apr_pool_t **p,
                                     timer_event_t **te);
+#define      ap_queue_pop(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);