httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <>
Subject Re: [PATCH] Don't accept more connections than workers
Date Fri, 26 Apr 2002 19:18:35 GMT
Bill Stoddard wrote:

>>On Fri, 26 Apr 2002, Bill Stoddard wrote:
>>>This is a patch to worker.c to prevent more connections from being
>>>accepted than there are workers to handle them.  The accept thread
>>>decrements the avail count and the workers increment the avail count. I
>>>don't have a linux box handy so i cannot confirm this patch compiles.
>>Besides, isn't there a race condition here?  Or are you assuming ++ and --
>>are atomic?
>Yep, and it is a bad assumption.

The safest place to increment/decrement the count is probably around the
apr_thread_cond_wait() call in the fd-queue pop function.  The worker thread
is holding the global mutex right before and right after that call.


View raw message