This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.

Scott Lamb

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]