This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Cancellation & async signal handlers
- From: Scott Lamb <slamb at slamb dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 05 Feb 2004 13:32:21 -0600
- Subject: Cancellation & async signal handlers
I've got another question about thread cancellation. First, am I in the
right place for this? This is like my third message about cancellation
and I haven't seen much in the way of replies.
Okay, my question: what should happen if you receive a cancellation
request in a cancellation point (specifically write()) that is called
from an async signal handler? The standards do not seem too clear on
this point. I'd be happy just disabling cancellation for the duration of
the signal handler, but pthread_setcancelstate() is not marked as async
signal-safe.
I wrote a test program, and glibc appears to occasionally hang. Is this
a bug? Did I screw up the test (quite possible)? Or is this just
undefined behavior? And if there is undefined behavior, I'd greatly
appreciate any suggestions for an alternate way of waiting for any one of:
- IO events
- signals
- cancellation requests
pselect() seems good in concept but the Linux implementation contains a
race, as noted in the manual page. Besides, there is no pepoll(). And
there's no kqueue on Linux, so I don't see any alternative.
Thanks,
Scott Lamb