[528] in Pthreads mailing list archive
Re: wait on a file descriptor and a condition variable
daemon@ATHENA.MIT.EDU (Seiki Shibata)
Tue Nov 26 11:50:10 1996
From: Seiki Shibata <seiki@flab.fujitsu.co.jp>
To: Ian Piumarta <piumarta@prof.inria.fr>
Cc: pthreads@MIT.EDU
In-Reply-To: Your message of Tue, 26 Nov 1996 15:18:52 +0100.
<199611261418.PAA11939@prof.inria.fr>
Date: Wed, 27 Nov 1996 00:09:46 +0900
Thanks, Ian.
> > 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...)
I already have two threads. One waits on a file descriptor with
select() and another waits on a condition variable with
condition_wait(). It doesn't work. The pthread kernel has to wait on
these two events.
Currently, I'm polling at small intervals.
I was sorry not to explain this situation.
--
SHIBATA Seiki (seiki@flab.fujitsu.co.jp)