> >   +    * The worker MPM should not accept more connections than it
> >   +      currently has available workers. Instead, the listener thread
> >   +      should block on a condition of the fdqueue such that it waits
> >   +      until there are at least one idle worker before continuing
> >   +      into the accept-loop.
>
> Here is an alternate idea... keep track of the number of available workers with a
counter.
> If the accept loop detects that the number of available workers has dropped to 0, the
> accept thread simply yields it's quanta. Very simple and no overhead associated with 
>a
> condition variable. Something like this:
>
> if (!avail_workers) {
>    yield(); /* or what ever the Unix call is. I know there must be one */
>    continue;
> }
> else {
>    accept();
> }
>
> Bill

Forgot to mention what is probably obvious... this is not a perfect solution because of
race conditions between the threads incrementing/decrementing avail_workers and the
listener thread doing the checking. It narrows the exposure but does not eliminate it
entirely.

Bill

Reply via email to