httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@clove.org>
Subject Re: cvs commit: httpd-2.0/server/mpm/experimental/threadpool threadpool.c
Date Mon, 29 Apr 2002 04:31:23 GMT
> Why do mutex locking/unlocking around the cond_wait()?  In the original
> implementation, the worker thread just locked the mutex once at startup
> and then let the cond_wait() unlock and re-lock it for each connection.
> With this new code, we're now doing twice as many lock/unlock operations
> per request.

We can't just rely on waking up from cond_wait() to mean that the
condition was reached, we have to check some state. Otherwise we aren't
protecting from spurrious wakeups. We test for that condition by checking
what state the worker is in when it wakes up, and to set that state we
have to hold the mutex.

-aaron

Mime
View raw message