9.10.2011 - stable backup commit
This commit is contained in:
54
pisignals.h
Normal file
54
pisignals.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef PISIGNALS_H
|
||||
#define PISIGNALS_H
|
||||
|
||||
#include "picontainers.h"
|
||||
#include <csignal>
|
||||
|
||||
class PISignals
|
||||
{
|
||||
public:
|
||||
enum Signal {
|
||||
Interrupt = 0x01, // Term Interrupt from keyboard
|
||||
Illegal = 0x02, // Core Illegal Instruction
|
||||
Abort = 0x04, // Core Abort signal from abort
|
||||
FPE = 0x08, // Core Floating point exception
|
||||
SegFault = 0x10, // Core Invalid memory reference
|
||||
Termination = 0x20, // Term Termination signal
|
||||
#ifndef WINDOWS
|
||||
Hangup = 0x40, // Term Hangup detected on controlling terminal or death of controlling process
|
||||
Quit = 0x80, // Core Quit from keyboard
|
||||
Kill = 0x100, // Term Kill signal
|
||||
BrokenPipe = 0x200, // Term Broken pipe: write to pipe with no readers
|
||||
Timer = 0x400, // Term Timer signal from alarm
|
||||
UserDefined1 = 0x800, // Term User-defined signal 1
|
||||
UserDefined2 = 0x1000, // Term User-defined signal 2
|
||||
ChildStopped = 0x2000, // Ign Child stopped or terminated
|
||||
Continue = 0x4000, // Cont Continue if stopped
|
||||
StopProcess = 0x8000, // Stop Stop process
|
||||
StopTTY = 0x10000, // Stop Stop typed at tty
|
||||
StopTTYInput = 0x20000, // Stop tty input for background process
|
||||
StopTTYOutput = 0x40000, // Stop tty output for background process
|
||||
#endif
|
||||
All = 0xFFFFF
|
||||
};
|
||||
|
||||
typedef void (*SignalEvent)(PISignals::Signal);
|
||||
|
||||
static void setSlot(SignalEvent slot) {ret_func = slot;}
|
||||
static void grabSignals(PIFlags<PISignals::Signal> signals_);
|
||||
static void raiseSignal(PISignals::Signal signal) {raise(signalCode(signal));}
|
||||
|
||||
private:
|
||||
PISignals() {ret_func = 0;}
|
||||
~PISignals() {}
|
||||
|
||||
static int signalCode(PISignals::Signal signal);
|
||||
static PISignals::Signal signalFromCode(int signal);
|
||||
static void signal_event(int signal);
|
||||
|
||||
static SignalEvent ret_func;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // PISIGNALS_H
|
||||
Reference in New Issue
Block a user