From 464b62610a6d571c7477a7c2e1b458290c57316c Mon Sep 17 00:00:00 2001 From: Aaron Bannert Date: Sun, 28 Apr 2002 22:32:17 +0000 Subject: [PATCH] Clarify an incorrect statement about why we're purposfully putting the signal inside of a mutex. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94842 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/experimental/threadpool/threadpool.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server/mpm/experimental/threadpool/threadpool.c b/server/mpm/experimental/threadpool/threadpool.c index 33f4a17ad4..ac63d901d1 100644 --- a/server/mpm/experimental/threadpool/threadpool.c +++ b/server/mpm/experimental/threadpool/threadpool.c @@ -952,8 +952,11 @@ static void *listener_thread(apr_thread_t *thd, void * dummy) /* Wake up the sleeping worker. */ apr_thread_mutex_lock(worker->mutex); worker->csd = (apr_socket_t *)csd; - /* We must own the lock associated with the condition - * variable that we are signaling. */ + /* Posix allows us to signal this condition without + * owning the associated mutex, but in that case it can + * not guarantee predictable scheduling. See + * _UNIX Network Programming: Interprocess Communication_ + * by W. Richard Stevens, Vol 2, 2nd Ed, pp. 170-171. */ apr_thread_cond_signal(worker->cond); apr_thread_mutex_unlock(worker->mutex); worker = NULL; @@ -975,8 +978,11 @@ static void *listener_thread(apr_thread_t *thd, void * dummy) worker_stack_interrupt_all(idle_worker_stack); if (worker) { apr_thread_mutex_lock(worker->mutex); - /* We must own the lock associated with the condition - * variable that we are signaling. */ + /* Posix allows us to signal this condition without + * owning the associated mutex, but in that case it can + * not guarantee predictable scheduling. See + * _UNIX Network Programming: Interprocess Communication_ + * by W. Richard Stevens, Vol 2, 2nd Ed, pp. 170-171. */ apr_thread_cond_signal(worker->cond); apr_thread_mutex_unlock(worker->mutex); } -- 2.40.0