libassa 3.5.1
Loading...
Searching...
No Matches
SigHandler.h
Go to the documentation of this file.
1// -*- c++ -*-
2//------------------------------------------------------------------------------
3// SigHandler.h
4//------------------------------------------------------------------------------
5// Copyright (c) 1997 by Vladislav Grinchenko
6//
7// This library is free software; you can redistribute it and/or
8// modify it under the terms of the GNU Library General Public
9// License as published by the Free Software Foundation; either
10// version 2 of the License, or (at your option) any later version.
11//------------------------------------------------------------------------------
12#ifndef _SigHandler_h
13#define _SigHandler_h
14
15// System includes
16
17#include <signal.h>
18#include <errno.h>
19
20#include "assa/Logger.h"
21#include "assa/IdSet.h"
22#include "assa/SigSet.h"
23#include "assa/SigAction.h"
24#include "assa/EventHandler.h"
25
26namespace ASSA {
27
28#if !defined(WIN32)
29
50{
51public:
54 virtual ~SigHandler () { /* no-op */ }
55
71 virtual int install (int signum_,
75 SigAction* old_disp_ = 0);
76
89 virtual int remove (int signum_,
90 EventHandler* eh_ = 0,
92 SigAction* old_disp_ = 0);
93
103 static void dispatch (int signum_);
104
112
116
117protected:
121 int in_range(int signum_);
122
123private:
128};
129
130#endif // !defined(WIN32)
131
132} // end namespace ASSA
133
134#endif /* _SigHandler_h */
An abstract interface for handling I/O events, timers, and such.
Class IdSet implements a set of reusable unique IDs, up to 1024.
An abstraction to message logging facility.
SigAction is a C++ wrapper around sigaction structure.
SigSet is a wrapper for UNIX sigset_t structure that provides all manipulators on this structure as w...
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
EventHandler class.
static EventHandler * m_signal_handlers[NSIG]
Static array that stores one user-defined event handler pointer for every signal.
Definition SigHandler.h:127
virtual int remove(int signum_, EventHandler *eh_=0, SigAction *new_disp_=0, SigAction *old_disp_=0)
Remove EventHandler associated with signum_.
virtual ~SigHandler()
No-op virtual destructor.
Definition SigHandler.h:54
static void dispatch(int signum_)
Here is the heart of SigHandler class.
int in_range(int signum_)
Check that signum_ is in valid range.
EventHandler * handler(int signum_, EventHandler *new_)
Set new event handler for signal signum_ and return an existing one.
virtual int install(int signum_, EventHandler *new_hand_, SigAction *new_disp_=0, EventHandler **old_hand_=0, SigAction *old_disp_=0)
Add new signal handler and new disposition for the signal.