simonmar:
> On 14 September 2004 21:43, Donald Bruce Stewart wrote:
> 
> > Unexpected failures:
> ...
> >    signals002(threaded)
> 
> Don - any idea what this one is about?
> 
> Cheers,
>       Simon

The normal signal tests run correctly. 
However, if we we compile with -threaded the signal isn't blocked:

        main = do
          blockSignals ( userDefinedSignal1 `addSignal` emptySignalSet )
          raiseSignal userDefinedSignal1

which produces:
        $ ghc -no-recomp -o signals002 signals002.hs -threaded -package unix           
     
        $ ./signals002
        zsh: user-defined signal 1  ./signals002

So, what I've got so far is that blockSignals isn't working in threaded mode.
Hmm. Let's try a C program:

        #include <signal.h>

        void f(void) {
                sigset_t set;
                sigemptyset(&set);
                sigaddset(&set, SIGUSR1);
                sigprocmask(SIG_BLOCK, &set, NULL);
                raise(SIGUSR1);
        }

        int main() { f(); exit(0); }

Here we go:
        $ gcc t.c
        $ ./a.out 

Good. It blocked the signal. And with -lpthread:
        $ gcc -lpthread t.c
        $ ./a.out 
        zsh: user-defined signal 1  ./a.out

Ah ha! So signals go a bit wonky when you *link in* pthreads.
But we don't get this behaviour on Linux. Hmm, and we do on FreeBSD too:

        % uname -msr
        FreeBSD 5.0-RELEASE i386

        % gcc t.c
        % ./a.out 

        % gcc -pthread t.c
        % ./a.out 
        zsh: user-defined signal 1  ./a.out

Same threads implementation. And using pthread_sigmask() instead of
sigprocmask doesn't help. On Linux pthread_sigmask blocks the signal quite fine.

So this looks like a BSD pthread issue: how do we block signals when
using pthreads on BSD (or the Mac probably)? And a bit nasty that just
linking in -lpthread breaks the code :(

More investigations...

-- Don
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to