Newsgroups: comp.parallel.pvm
From: orenl@mangal.cs.huji.ac.il (Oren Laden)
Subject: Re: Once more: Signals & PVM
Organization: The Hebrew U. of Jerusalem, Computer Science Dept.
Date: 23 Feb 1995 14:11:11 GMT
Message-ID: <3ii520$e6h@pretzel.cs.huji.ac.il>

In article <3i6nsf$33e@reuter.cse.ogi.edu>, crispin@helix.cse.ogi.edu (Crispin Cowan) writes:

|> In article <3hvop8INN8bq@duncan.cs.utk.edu>,
|> Philip Papadopoulos <papadopo@cs.utk.edu> wrote:
|> >There are some not-very-elegant ways to circumvent the fact the PVM
|> >is not re-entrant.  The most straight-forward method is to
|> >block the signal before calling
|> >each PVM routine and enable afterwards. If a single X signal arrives while
|> >blocked, the handler will be called after it is enabled. If multiple
|>
|> Unfortunately, that is not the case.  If a single X signal arrives
|> while blocked, it is dropped on the floor and ignored.  UNIX signals
|> are stupider than processor interrupts:  they don't persist just
|> because they are masked.
|>
|> ....

Well, this isn't quite true. On UNIX, if you block a signal and it arrives
while it is blocked, it will wait until you unblock it, and the interrupt.
Try the following code:

#include <stdio.h>
#include <signal.h>
#include <unistd.h>

void handler()
{
        printf("in handler !\n");
        return ;
}

main()
{
        int mask;

        signal(SIGUSR1,handler);
        mask = sigblock(sigmask(SIGUSR1));
        kill(getpid(),SIGUSR1);
        sleep(1);
        printf("The signal is blocked\n");
        mask = sigsetmask(mask);
        printf("This will be printed after the handler message !\n");
        exit(0);
}


	-- Oren.


