[526] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Re: wait on a file descriptor and a condition variable

daemon@ATHENA.MIT.EDU (Ian Piumarta)
Tue Nov 26 09:33:34 1996

Date: Tue, 26 Nov 1996 15:18:52 +0100
From: Ian Piumarta <piumarta@prof.inria.fr>
To: seiki@akashi.flab.fujitsu.co.jp
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 -----------------------

home help back first fref pref prev next nref lref last post