summaryrefslogtreecommitdiff
path: root/utils/Signal.h
blob: d27bcb53617fb07aeb12e5f1a1a0b14827c12213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 *	CENA C++ Utilities
 *
 *	by Stephane Chatty
 *
 *	Copyright 1992
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	Signal handling
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef Signal_H_
#define Signal_H_

#include "cplus_bugs.h"
class IvlList;

#ifdef CPLUS_BUG21
#ifdef sun
#define NSIG 32
#else
#include <signal.h>
#endif
#endif

class IvlBaseSignalHandler {
private:
static	IvlList*	HandlerStacks;
static	void	ClassInit ();
	void	Install ();
static	void	InstallNone (int);
static	void	DoHandle (int);

protected:
	int	Signal;

public:
		IvlBaseSignalHandler (int);
virtual		~IvlBaseSignalHandler ();
inline	int	GetSignal () const	{ return Signal; }

protected:
/*?public?*/
virtual	void	Handle ();
};

extern const int AllSigs, SigHup, SigInt, SigQuit, SigIll, SigTrap, SigAbrt, SigEmt, SigFpe,
	SigKill, SigBus, SigSegv, SigSys, SigPipe, SigAlrm, SigTerm, SigUsr1,
	SigUsr2, SigChld, SigVtalrm, SigIo, SigStop,
	SigTstp, SigCont, SigTtin, SigTtou, SigUrg, SigLost;

class IvlSignalHandler : public IvlBaseSignalHandler {
protected:
	void	(*Handler) (int);
	void	Handle ();

public:
		IvlSignalHandler (int, void (*) (int));
		~IvlSignalHandler ();
};

class IvlSignalBlocker {
private:
#ifndef CPLUS_BUG21
static	int	BlockCounts [];
#else
static	int	BlockCounts [NSIG-1];
#endif
protected:
	int	Signal:6;
public:
		IvlSignalBlocker (int);
		~IvlSignalBlocker ();
};

#endif	/* Signal_H_ */