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 12:24:52 UTC

svn commit: r1821635 - in /httpd/httpd/trunk/server: mpm_fdqueue.c mpm_fdqueue.h

Author: ylavic
Date: Fri Jan 19 12:24:52 2018
New Revision: 1821635

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

Prepare mpm_worker to use common fdqueue.


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

Modified: httpd/httpd/trunk/server/mpm_fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_fdqueue.c?rev=1821635&r1=1821634&r2=1821635&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm_fdqueue.c Fri Jan 19 12:24:52 2018
@@ -180,7 +180,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) {
@@ -442,6 +444,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) {
@@ -468,20 +471,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_fdqueue.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_fdqueue.h?rev=1821635&r1=1821634&r2=1821635&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_fdqueue.h (original)
+++ httpd/httpd/trunk/server/mpm_fdqueue.h Fri Jan 19 12:24:52 2018
@@ -92,6 +92,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);