jthread and handleIO(true)

Archie Cobbs archie at whistle.com
Thu Nov 19 10:55:09 PST 1998


Godmar Back writes:
> It appears that blocking signals before we go into the select is the
> only way to really fix that.  That shouldn't hurt us much, though,
> since it'll only happen when the system is about to go idle in select.

I've faced a similar problem in a program that tries to handle
both file descriptor events and signal events at the same time.
There's no easy way to do it directly without a race condition.
What you have to do is ...

 - Open a pipe, which you always select for reading when calling select()
 - Don't block signals during select()
 - When you get a signal, write a byte to the pipe and return

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list