lkml.org 
[lkml]   [1999]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Linus on Linux, Apache and Threads
Date
> 
> Can I just get some clarification here. pthread_cond_signal is
> defined as waking *one* thread, thus:
>
> pthread_cond_signal restarts one of the threads that are
> waiting on the condition variable cond. If no threads are
> waiting on cond, nothing happens. If several threads are
> waiting on cond, exactly one is restarted, but it is not
> specified which.
>
> Are you saying that the kernel will in fact wake up *all* the threads
> (either just internally, or in actuality)?
In implementations i know off, the first in the queue waiting for the cond
variable to be signalled is restarted. But depending on the implementation
one can considering waking up a thread so as to utilise the system resources
in a * optimal * manner.

This is all the more true, because, if multiple threads are waiting for a
condition to occur and only one pthread_cond_signal comes in, the signalling
thread is not intersted in waking up any * particular * thread.

thanks,
Rama.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.078 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site