httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@clove.org>
Subject Re: [PATCH 2] worker MPM deadlock
Date Wed, 22 May 2002 17:55:55 GMT
On Wed, May 22, 2002 at 01:50:44PM -0400, Cliff Woolley wrote:
> Right.  pthread_yield seems to be a non-portable extension, if I'm reading
> right.  From /usr/include/pthread.h on Linux:
> 
> #ifdef __USE_GNU
> /* Yield the processor to another thread or process.
>    This function is similar to the POSIX `sched_yield' function but
>    might be differently implemented in the case of a m-on-n thread
>    implementation.  */
> extern int pthread_yield (void) __THROW;
> #endif
> 
> But likewise, yield() is not portable and neither is sched_yield().  This
> is why we need apr_thread_yield() to be implemented on Unix, as I
> mentioned the last time this came up.  But it's not.
> 
> void apr_thread_yield()
> {
> }

The reason it's not implemented is because it's not guaranteed to do
anything. Yielding is up to the discresion of the underlying system,
and depending on many things it may behave differently. We can not
get predictable scheduling with any variant of yield() in a way that
will be portable. The only method we have right now for predictable
scheduling in APR is apr_thread_cond.h.

-aaron

Mime
View raw message