[527] in Pthreads mailing list archive
Re: wait on a file descriptor and a condition variable
daemon@ATHENA.MIT.EDU (Ian Piumarta)
Tue Nov 26 11:33:44 1996
To: daf@sdoatl.mmr.lucent.com
Date: Tue, 26 Nov 1996 15:18:52 +0100
From: Ian Piumarta <piumarta@prof.inria.fr>
Cc: pthreads@MIT.EDU
In-Reply-To: <9611261400.AA10630@meridian.akashi.flab.fujitsu.co.jp>
(seiki@flab.fujitsu.co.jp)
> I need a method to wait on a file descriptor and a condition variable
> simultaneously. The condition_signal() and the condition_broadcast()
> call can not wake up the blocking select() call.
First guess: you need two threads.
Just before the "real" thread waits on the CV, it creates another thread
which waits on the select() -- when the select() returns, this second thread
sets an appropriate flag and signals/broadcasts the CV. The "real" thread
can then figure out what happened based on the contents of the CV and the
flag. (I wouldn't like to guess what races might be involved here...)
Any advance on two threads?
;-)
Ian
------------------------------- projet SOR -------------------------------
Ian Piumarta, INRIA Rocquencourt, Internet: Ian.Piumarta@inria.fr
BP105, 78153 Le Chesnay Cedex, FRANCE Voice: +33 1 39 63 52 87
----------------------- Systemes a Objets Repartis -----------------------