Hi all,
I have an application which attempts to block all signals using
pthread_sigmask(). I'm aware that this only works on the current thread,
however this call occurs before any other threads are created and so
should be inherited. I call it as follows:

    sigset_t signalSet;

    (void)sigfillset(&signalSet);
    (void)pthread_sigmask(SIG_BLOCK, &signalSet, NULL);

However, it seems that signals such as SIGPIPE, SIGINT, etc will still
kill the process. I also tried replacing the pthread_sigmask call with
sigprocmask to see if it made any difference, which it didn't.

The only other relevant info I can think of, is that I start up another
thread specifically for catching SIGTERM, thusly:

    (void)sigemptyset(&signalSet);
    (void)sigaddset(&signalSet, SIGTERM);
    if (sigwait(&signalSet, &signo) < 0 || signo != SIGTERM)
        /* some error handling */;

    /* shutdown cleanly */
    etc.

This part still works as expected.

Additionally, I have the same code working under Solaris threads (not pthreads
on Solaris) fine, the only relevant change being the call thr_sigsetmask
instead of pthread_sigmask.

The same behaviour is exhibited on 4.3-RELEASE and 4.4-RELEASE.

Any ideas on what is wrong?

regards,
    Callum

(c)2002 Callum Gibson                       [EMAIL PROTECTED]
Global Markets IT, Deutsche Bank, Australia       61 2 9258 1620
### The opinions in this message are mine and not Deutsche's ###

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to