From 789d28d6cc6863777bfbaa04877bcf70da50bdac Mon Sep 17 00:00:00 2001 From: Brian Pane Date: Sun, 28 Apr 2002 03:32:10 +0000 Subject: [PATCH] Move a potentially expensive pool cleanup operation outside the mutex-protected critical path of ap_queue_pop() git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94828 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/worker/fdqueue.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/mpm/worker/fdqueue.c b/server/mpm/worker/fdqueue.c index 7d9263ff01..673a3927a1 100644 --- a/server/mpm/worker/fdqueue.c +++ b/server/mpm/worker/fdqueue.c @@ -286,6 +286,7 @@ apr_status_t ap_queue_pop(fd_queue_t *queue, apr_socket_t **sd, apr_pool_t **p, { fd_queue_elem_t *elem; apr_status_t rv; + int delete_pool = 0; if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) { if (recycled_pool) { @@ -299,7 +300,7 @@ apr_status_t ap_queue_pop(fd_queue_t *queue, apr_socket_t **sd, apr_pool_t **p, queue->recycled_pools[queue->num_recycled++] = recycled_pool; } else { - apr_pool_destroy(recycled_pool); + delete_pool = 1; } } @@ -311,8 +312,14 @@ apr_status_t ap_queue_pop(fd_queue_t *queue, apr_socket_t **sd, apr_pool_t **p, /* If we wake up and it's still empty, then we were interrupted */ if (ap_queue_empty(queue)) { if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) { + if (delete_pool) { + apr_pool_destroy(recycled_pool); + } return rv; } + if (delete_pool) { + apr_pool_destroy(recycled_pool); + } if (queue->terminated) { return APR_EOF; /* no more elements ever again */ } -- 2.40.0