From: Yann Ylavic Date: Fri, 19 Jan 2018 09:39:29 +0000 (+0000) Subject: mpm_unix: Follow up to r1821526. X-Git-Tag: 2.5.0-alpha2-ci-test-only~2949 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56cfe4c25f59931328f9c8335077f48b7133dba8;p=thirdparty%2Fapache%2Fhttpd.git mpm_unix: Follow up to r1821526. 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 --- diff --git a/server/mpm_unix.c b/server/mpm_unix.c index 5a2f132a4a2..b76febece08 100644 --- a/server/mpm_unix.c +++ b/server/mpm_unix.c @@ -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; diff --git a/server/mpm_unix.h b/server/mpm_unix.h index e541c35bf1f..13c4aceaa21 100644 --- a/server/mpm_unix.h +++ b/server/mpm_unix.h @@ -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);