Newsgroups: comp.parallel.mpi
From: Lothar Thum <thum@mathpool.uni-augsburg.de>
Subject: Q: MT LAM/MPI programs and signals
Organization: Universitaet Augsburg (Germany)
Date: Fri, 11 Oct 1996 11:39:12 +0200
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <325E15C0.167E@mathpool.uni-augsburg.de>

Hello,

i'm working with LAM/MPI in a multithreaded environment. I tried to
terminate a spawned child program (generated by a MPIL_Spawn) with
MPIL_Signal(...., LAM_SIGUDIE). That works fine in a single-threaded
environment, but everything is different in a multithreaded environment.
I have read the best way to handle this problem is to set up a signal
catcher thread which does all the work with signals.

Somehow like this:
(with the AIX32 DCE Threads package)

pthread_addr_t signal_catcher(pthread_addr_t dummy)
{
   sigset_t signals;
   int sig;
   
   sigemptyset(&signals);
   sigaddset(&signals, SIGTERM);
   sigprocmask(SIG_BLOCK, &signals, NULL);
   while (1)
   {
      sig = sigwait(&signals);
      switch(sig)
      {
         case SIGTERM:
         {
            /* do something SIGTERM specific */
         }
            break;
            
         default:
             continue;
      }
      break;
   }
   sigprocmask(SIG_UNBLOCK, &signals, NULL);
   exit(1);
}


My question is: Is SIGTERM really the symbolic signal number that
                corresponds to LAM_SIGUDIE ?
                Or doesn't MPIL_Signal use signals at all ???


Best regards,
Lothar.

