I have a thread that requires sleep() to run for 5 mins, but I would like this to return when I send a SIGTERM from the command line. SIGTERM is caught by a process-wide handler. So far I have no success. What I've tried so far...

1. Sending a SIGTERM to the process goes directly to the signal handler and does not interrupt the threads.

1. Empty the signal mask of the thread using pthread_sigmask() and still my sleep() inside a thread is not interrupted.

2. Send a SIGTERM to the thread using pthread_kill() inside my handler...but my signal handler catches this again resulting in an endless catching and pthread_kill() loop.

Any suggestions welcome. At the moment I might just sleep() every few seconds and poll a particular variable but I would prefer sleeping for 5 or more minutes.

Carlo


_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to