Diana Software
QDianaProcessStatus.cc
Go to the documentation of this file.
1 /*
2 * APOLLO: A complete DAQ and Online Data Analysis Framework for Diana
3 * $Id: QDianaProcessStatus.cc 557 2006-12-14 17:00:51Z giacher $
4 * M.P. created 26/5/4
5 *
6 * Class QDianaProcessStatus: class that describes the status of a process
7 * and provides the signal handler for the relevant signals.
8 * For the description of the signal table and its meaning see
9 * header file QDianaProcessStatus.hh
10 *
11 */
12 
13 #include <sys/types.h>
14 #include <unistd.h>
15 #include <signal.h>
16 #include <string>
17 #include <iostream>
18 #include "QDianaProcessStatus.hh"
19 
20 
22 {
23  static QDianaProcessStatus instance;
24  return instance;
25 }
26 
27 
28 // ctor
30  QNamed( ""),
31  QId( ::getpid() ),
32  state(QRunning_s) {
33 
34  signal(SIGINT,ProcessControlSignalHandler); // die
35  // signal(SIGSEGV,ProcessControlSignalHandler); // error
36  // signal(SIGFPE,ProcessControlSignalHandler); // error
37 
38  std::string s1("");
39  SetError(s1);
40 }
41 
42 void ProcessControlSignalHandler( int SignalId ) {
44 
45 // // SIGSEGV, SIGFPE: set status to QError_s and set error string
46 // if ( SignalId == SIGSEGV || SignalId == SIGFPE ) {
47 // s.SetState( QDianaProcessStatus::QError_s );
48 // if(SIGSEGV == SignalId) {
49 // s1 = "Segmentation Violation Detected";
50 // s.SetError(s1);
51 // }
52 // if(SIGFPE == SignalId) {
53 // s1 = "Floating Point Exception Detected";
54 // s.SetError(s1);
55 // }
56 // return;
57 // }
58 
59 
60  // SIGINT set status to QExiting
61  if ( SIGINT == SignalId ) {
63  return;
64  }
65 
66 }
double s1
Definition: CheckOFShape.C:248
@ QRunning_s
void ProcessControlSignalHandler(int SignalId)
singleton that manage diana status
void SetError(const std::string &s)
set error string according to detected signal
friend void ProcessControlSignalHandler(int)
static QDianaProcessStatus & GetInstance()
get instance
void SetState(const ProcessStatus_t s)
change process status according to detected signal
base class for anything having an id
Definition: QId.hh:13
base class for anything that has a name
Definition: QNamed.hh:14