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/19 09:39:29 UTC

svn commit: r1821607 - in /httpd/httpd/trunk/server: mpm_unix.c mpm_unix.h

Author: ylavic
Date: Fri Jan 19 09:39:29 2018
New Revision: 1821607

URL: http://svn.apache.org/viewvc?rev=1821607&view=rev
Log:
mpm_unix: Follow up to r1821526.

Prepare mpm_worker to use common fdqueue.


Modified:
    httpd/httpd/trunk/server/mpm_unix.c
    httpd/httpd/trunk/server/mpm_unix.h

Modified: httpd/httpd/trunk/server/mpm_unix.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_unix.c?rev=1821607&r1=1821606&r2=1821607&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_unix.c (original)
+++ httpd/httpd/trunk/server/mpm_unix.c Fri Jan 19 09:39:29 2018
@@ -1274,7 +1274,9 @@ apr_status_t ap_queue_info_wait_for_idle
          *     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_q
                                     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_q
         }
     }
 
-    *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;

Modified: httpd/httpd/trunk/server/mpm_unix.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_unix.h?rev=1821607&r1=1821606&r2=1821607&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_unix.h (original)
+++ httpd/httpd/trunk/server/mpm_unix.h Fri Jan 19 09:39:29 2018
@@ -91,6 +91,8 @@ apr_status_t ap_queue_push_timer(fd_queu
 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);