summaryrefslogtreecommitdiff
path: root/utils/Signal.h
blob: 5ce83abde164abbcaeb3027379723fdffccc1a11 (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
81
82
83
84
85
/*
 *	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_

#ifdef __GNUG__
#pragma interface
#endif

#include "cplus_bugs.h"
class CcuList;

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

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

protected:
	int	Signal;

public:
		CcuBaseSignalHandler (int);
virtual		~CcuBaseSignalHandler ();
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 CcuSignalHandler : public CcuBaseSignalHandler {
protected:
	void	(*Handler) (int);
	void	Handle ();

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


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

#endif	/* Signal_H_ */