AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliChildProcTerminator.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 2007
3 
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7  * full copyright notice. *
8  **************************************************************************/
9 
10 #include "AliChildProcTerminator.h"
11 
12 #include <sys/wait.h>
13 #include <signal.h>
14 
15 //______________________________________________________________________________
16 // Full description of AliChildProcTerminator
17 //
18 
20 
22 
24 {
25  if (fgTheOne == 0)
26  fgTheOne = new AliChildProcTerminator;
27  return fgTheOne;
28 }
29 
31 {
32  struct sigaction sac;
33  sac.sa_handler = sig_handler;
34  sigemptyset(&sac.sa_mask);
35  sac.sa_flags = 0;
36 
37  // The sa_restorer field is Not POSIX and obsolete.
38  // This is for compilation on other systems
39 #if defined(__linux) && \
40  (defined(__i386__) || defined(__x86_64__)) && \
41  defined(__GNUC__)
42  sac.sa_restorer= NULL;
43 #endif
44 
45  sigaction(SIGCHLD, &sac, 0);
46 }
47 
49 {
50  int status;
51  pid_t pid = wait(&status);
52  Instance()->ChildProcTerm(pid, status);
53 }
54 
55 void AliChildProcTerminator::ChildProcTerm(Int_t pid, Int_t status)
56 {
57  if (pid < 0) return;
58 
59  Long_t args[2];
60  args[0] = (Long_t) pid;
61  args[1] = (Long_t) status;
62 
63  Emit("ChildProcTerm(Int_t,Int_t)", args);
64 }
void ChildProcTerm(Int_t pid, Int_t status)
AliTPCcalibPID * pid
Definition: CalibPID.C:69
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
static AliChildProcTerminator * Instance()
static void sig_handler(int sig)