From: lathamr@us.ibm.com (Richard D. Latham)
Subject: Re: awaking a thread ... waiting on select or poll
Date: 12 Apr 2001 21:21:02 -0600 [thread overview]
Message-ID: <u4rvta3j5.fsf@us.ibm.com> (raw)
In-Reply-To: qIsB6.3628$zv6.2622115@typhoon2.ba-dsg.net
"MrSignor" <MrSignor@nospam_bellatlantic.net> writes:
> Is there a reliable way (across Unix platforms) to wake-up a thread
> sleeping/waiting on a Select or Poll, that is not timing out the request.
>
> Basically, I have a thread, waiting for work on 1-n sockets. Upon
> occassion, I would like to wake the sleeping-thread, because I
> need to bring something to it's attention.
>
Well, I alsmot hesitate to mention this because threads and signals
are like oil and water ... they don't mix very well :-)
But IIRC, you could use SIGUSR1 or SIGUSR2 to wake your other thread
out of a blocking select() or recv().
Note that several of the "middleware" products , notably MQ Series,
use threads and signals themselves ... and you have to play by
their rules if you're linking those libaries into your executable.
Hope this helps.
--
#include <disclaimer.std> /* I don't speak for IBM ... */
/* Heck, I don't even speak for myself */
/* Don't believe me ? Ask my wife :-) */
Richard D. Latham lathamr@us.ibm.com
next prev parent reply other threads:[~2001-04-13 3:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-13 1:34 awaking a thread ... waiting on select or poll MrSignor
2001-04-13 3:21 ` Richard D. Latham [this message]
2001-04-13 10:45 ` Dave Butenhof
2001-04-13 16:25 ` Logan Shaw
2001-05-29 17:29 ` anaonymous
2001-04-13 19:41 ` Norman Black
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox