libassa  3.5.1
SigHandlers.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //------------------------------------------------------------------------------
3 // SigHandlers.h
4 //------------------------------------------------------------------------------
5 // Copyright (C) 1997-2002 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 
13 #ifndef _SigHandlers_h
14 #define _SigHandlers_h
15 
16 // System includes
17 //
18 #include <signal.h>
19 #include <errno.h>
20 #include <sys/time.h> // select
21 #include <sys/types.h> // select
22 
23 #include "assa/SigHandler.h"
24 #include "assa/SigHandlersList.h"
25 #include "assa/Handlers.h"
26 
27 namespace ASSA {
28 
29 #if !defined(WIN32)
30 
55 class SigHandlers : public SigHandler
56 {
57 public:
63  static void sighandlers_dispatcher (int signum_);
64 
75  virtual int install (int signum_,
76  EventHandler* new_hand_,
77  SigAction* new_disp_ = 0,
78  EventHandler** old_hand_ = 0,
79  SigAction* old_disp_ = 0);
80 
97  virtual int remove (int signum_,
98  EventHandler* eh_,
99  SigAction* new_disp_ = 0,
100  SigAction* old_disp_ = 0);
101 private:
107  static void dispatch (int signum_);
108 };
109 
110 #endif // !defined(WIN32)
111 
112 } // end namespace ASSA
113 
114 #endif /* _SigHandlers_h */
A collection of various most popular signal handlers.
Class SigHandler is a UNIX signal handlers manager/dispatcher class.
SigHandlersList is a Singleton class that maps signal number to a set of EventHandlers listening for ...
EventHandler class.
Definition: EventHandler.h:103
static void sighandlers_dispatcher(int signum_)
A wrapper around static SigHandlers::dispatch().
Definition: SigHandlers.cpp:26
virtual int remove(int signum_, EventHandler *eh_, SigAction *new_disp_=0, SigAction *old_disp_=0)
Remove EventHandler from the list of registered handler for signum_.
virtual int install(int signum_, EventHandler *new_hand_, SigAction *new_disp_=0, EventHandler **old_hand_=0, SigAction *old_disp_=0)
Register EventHandler with dispatching system.
Definition: SigHandlers.cpp:36
static void dispatch(int signum_)
The heart of SigHandlers class - this callback function is really registered with OS to catch all of ...
Definition: Acceptor.h:40