Date: Mon, 18 May 2009 18:29:33 -0700 From: Chuck Swiger <cswiger@mac.com> To: Peter Steele <psteele@maxiscale.com> Cc: #freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: Why would a kill -2 not work? Message-ID: <45A2F58C-968F-47F7-90E3-1F84F0B122C9@mac.com> In-Reply-To: <25097232.1021242693162151.JavaMail.HALO$@halo> References: <25097232.1021242693162151.JavaMail.HALO$@halo>
next in thread | previous in thread | raw e-mail | index | archive | help
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); > KEEP_RUNNING = 0; > 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. -- -Chuck
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45A2F58C-968F-47F7-90E3-1F84F0B122C9>