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. >>>Sorry. >>> >>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. --Brian
