Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Feb 2002 13:06:23 +1100 (EST)
From:      callum.gibson@db.com
To:        hackers@freebsd.org
Subject:   pthread_sigmask problem
Message-ID:  <20020205020623.75168.qmail@merton.aus.deuba.com>

next in thread | raw e-mail | index | archive | help
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                       callum.gibson@db.com
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020205020623.75168.qmail>