[comp.os.mach] cthreads and queues

swfc@mendelssohn.cs.columbia.edu (Shu-Wie F Chen) (03/02/90)

I am posting this for a friend.

-------------------------------------------------------------------------------

    assume you have 3 threads in c-threads.   2 of them do a call.. but the
third is not ready to accept yet.  So we want the 2 of them to wait.  The 
easiest way to make them wait in c-threads is a conditional_wait(accept_ready)
, now both of the calling threads are waiting on the condition when the 3rd
thread is ready to accept.  When the third thread signals conditional_signal
(accept_ready) only one of the thread will be awakened, the c-threads manual
states that 'at least one of them will be awakened' but does not specify 
which one...

  here is my question:  If c1 was put on the condition_wait first before c2,
then when c3 is ready to accept will c-threads' implicit queue take care of
c1 getting the control of c3 first since it was put on the condition_wait
first.  if not, is there a way to implement this queue.. so that at least a 
fair amount of fairness can be obtained with a FIFO queue. The c-threads 
maunal does not specify if c-threads does an FIFO queue on a 
conditional_signal.

-------------------------------------------------------------------------------

Thanks.
*swfc

-------------------------------------------------------------------------------
Shu-Wie F Chen                                  Department of Computer Science
swfc@cs.columbia.edu                            Columbia University