Subj : async signal safety? [was Re: Semaphores and pthreads] To : comp.programming.threads From : Jomu Date : Mon Jan 10 2005 03:26 pm Butenhof's message is very instructive. It opened one old can of worms for me. I've implemented some signal handlers with few pthread_* calls used. One is pthread_self - I've seen it used by Boehm in his GC's signal handler, so I've used it also. Another one is pthread_getspecific. My rationale was that these handlers are invoked only when signaled threads were out of any pthread_ code, as it's in high level thread API which wraps all pthread calls related to my threads (it's still possible but not so likely that some linked C code will have it's own threads and pthread calls). So, it's impossible to get signal while in pthread code handling my pthread objects, and I think it's safe to call few pthread_ methods from my signal handler. Is it really safe? Or it's better and safer to implement these handlers without any pthread calls in any case? Is there any possibility this can be problem on any pthread implementation? Any examples? It is no problem to identify my thread by current stack pointer, but do I really need to reimplement this? Thanks, dd .