Re: Events

Christoph Rohland (hans-christoph.rohland@sap.com)
27 Jun 2000 11:21:53 +0200


Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

> > For example we have a thread, this thread handle the file
> > IO. When I'm wating for some data I can use the select
> > function to check it out if there is anything for me. If I
> > want to stop the thread during the select, I have no other
> > way except for the signal handlers functions.
> > It is not really handy, because the example above is too
> > simple. In our case is much more difficulter.
>
> Signal handling should do the job fine.

No, that's not right (and would be _really_ happy to stand
corrected). select and signals for interruption are not
compatible. You always have a race condition between unblocking the
signal and actually getting into select. AFAIK POSIX defines the
pselect call for this problem which also introduces a signal mask
argument. Without this, signals are useless to interrupt select.

Greetings
Christoph

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/