Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
signal.h
1
2
/***************************************************************************
3
* signal.h - This header defines a true OOo signal handler
4
* based on
5
* Douglas C. Schmidt
6
* "Applying Design Patterns to Simplify Signal Handling"
7
* http://www.cs.wustl.edu/~schmidt/signal-patterns.html
8
*
9
* Generated: Thu Jan 12 22:44:59 2006 (from FireVision)
10
* Copyright 2005-2006 Tim Niemueller [www.niemueller.de]
11
*
12
****************************************************************************/
13
14
/* This program is free software; you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation; either version 2 of the License, or
17
* (at your option) any later version. A runtime exception applies to
18
* this software (see LICENSE.GPL_WRE file mentioned below for details).
19
*
20
* This program is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
* GNU Library General Public License for more details.
24
*
25
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
26
*/
27
28
#ifndef __UTILS_SYSTEM_SIGNAL_H_
29
#define __UTILS_SYSTEM_SIGNAL_H_
30
31
#include <signal.h>
32
33
namespace
fawkes {
34
35
class
SignalHandler
{
36
public
:
37
virtual
~SignalHandler
() {}
38
virtual
void
handle_signal
(
int
signal) = 0;
39
};
40
41
42
class
SignalManager
{
43
44
public
:
45
static
SignalManager
*
instance
();
46
static
void
finalize
();
47
static
SignalHandler
*
register_handler
(
int
signum,
SignalHandler
*handler);
48
static
void
unregister_handler
(
int
signum);
49
static
void
unregister_handler
(
SignalHandler
*handler);
50
static
void
ignore
(
int
signum);
51
52
private
:
53
// Guard constructors, make sure we are a singleton
54
SignalManager
();
55
SignalManager
(
const
SignalManager
& cc);
56
57
static
SignalManager
*__instance;
58
59
// Entry point adapter installed into <sigaction>
60
// (must be a static method or a stand-alone
61
// extern "C" function).
62
static
void
dispatcher (
int
signum);
63
64
// restores default signal handler, called by unregister_*
65
static
void
restore_default(
int
signum);
66
67
// Table of pointers to concrete <SignalHandler>s
68
// registered by applications. NSIG is the number of
69
// signals defined in <signal.h>.
70
static
SignalHandler
* __signal_handlers[NSIG];
71
72
};
73
74
}
// end namespace fawkes
75
76
#endif
src
libs
utils
system
signal.h
Generated by
1.8.1.2