Why would a kill -2 not work?

Chuck Swiger cswiger at mac.com
Tue May 19 01:29:34 UTC 2009

On May 18, 2009, at 5:32 PM, Peter Steele wrote:
> No, I'm not sending a signal within a signal. The signal handler is  
> this:
> pthread_mutex_lock(&keep_running_mutex);
> pthread_cond_signal(&keep_running_cond);
> pthread_mutex_unlock(&keep_running_mutex);
> This works fine, but at some point it seems to stop working. The app  
> just continues to run as if it never received the -2 signal. We have  
> to use a kill -9 to kill it, which we want to avoid because this  
> prevents our shutdown code from executing.

The pthread_* calls you are making aren't listed as being safe to run  
within the context of a signal handler, and could cause a thread  
waiting on that condition to be unblocked and start running.  Please  
see earlier comments about mixing threads and signal handlers.


More information about the freebsd-questions mailing list