NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/25563



The following reply was made to PR lib/25563; it has been noted by GNATS.

From: Andrew Doran <ad%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/25563
Date: Sat, 28 Mar 2009 20:43:58 +0000

 On Sat, Mar 28, 2009 at 03:30:04AM +0000, David Holland wrote:
 
 >  What's supposed to happen if you use sigaltstack in a multithreaded
 >  program anyway? Is the alternate stack supposed to be per-thread?
 
 Pretty much everything about signals is per-thread except for the signal
 disposition and job control.
 
 pthreads isn't signal handler safe. That is to say, you can't go calling
 pthread_create() from a signal handler. In reality a limited set of stuff
 _should_ work, say pthread_self() and pthread_kill(), because there are
 buggy applications that expect them to work.
 
 We have system calls stubs in the thread library for cancellation. They are
 defined to be signal handler safe yet must use pthread__self(), so even if
 we ignore the above case we need to fix it for libpthread itself to work
 correctly (assuming the cancellation implementation remains unchanged).
 
 There is another nasty. pthread__cancelled() can't work correctly in a
 signal handler, because it has to take locks. And another nasty: we have
 any number of routines in libc that can interrupted and cancelled while
 holding locks.
 
 That's enough depressing thought for tonight, I am going to go back to
 enjoying my beer.
 


Home | Main Index | Thread Index | Old Index