PGROUTING  2.5
SignalHandler Class Reference

#include "signalhandler.h"

Collaboration diagram for SignalHandler:

Public Member Functions

EventHandlerregisterHandler (int signum, EventHandler *eh)
 
void removeHandler (int signum)
 

Static Public Member Functions

static SignalHandlerinstance (void)
 

Private Member Functions

 SignalHandler (void)
 

Static Private Member Functions

static void dispatcher (int signum)
 

Static Private Attributes

static SignalHandlerinstance_ = NULL
 
static EventHandlersignalHandlers_ [NSIG]
 

Detailed Description

Definition at line 70 of file signalhandler.h.

Constructor & Destructor Documentation

SignalHandler::SignalHandler ( void  )
inlineprivate

Definition at line 87 of file signalhandler.h.

Referenced by instance().

87 {}

Here is the caller graph for this function:

Member Function Documentation

void SignalHandler::dispatcher ( int  signum)
staticprivate

Definition at line 73 of file signalhandler.cpp.

References EventHandler::handleSignal(), instance_, and signalHandlers_.

Referenced by registerHandler().

73  {
74  // Perform a sanity check...
75  if (SignalHandler::signalHandlers_[signum] != 0)
76  // Dispatch the handler's hook method.
78 }
virtual void handleSignal(int signum)=0
static EventHandler * signalHandlers_[NSIG]

Here is the call graph for this function:

Here is the caller graph for this function:

SignalHandler * SignalHandler::instance ( void  )
static

Definition at line 38 of file signalhandler.cpp.

References instance_, and SignalHandler().

38  {
39  if (!instance_) instance_ = new SignalHandler;
40 
41  // assert(instance_ != NULL);
42  return instance_;
43 }
static SignalHandler * instance_
Definition: signalhandler.h:90
SignalHandler(void)
Definition: signalhandler.h:87

Here is the call graph for this function:

EventHandler * SignalHandler::registerHandler ( int  signum,
EventHandler eh 
)

Definition at line 47 of file signalhandler.cpp.

References dispatcher(), and signalHandlers_.

47  {
48  // Copy the <old_eh> from the <signum> slot in
49  // the <signalHandlers_> table.
50  EventHandler *old_eh = signalHandlers_[signum];
51 
52  // Store <eh> into the <signum> slot in the
53  // <signalHandlers_> table.
54  SignalHandler::signalHandlers_[signum] = eh;
55 
56  // Register the <dispatcher> to handle this
57  // <signum>.
58  struct sigaction sa;
59  sa.sa_handler = SignalHandler::dispatcher;
60  sigemptyset(&sa.sa_mask);
61  sa.sa_flags = 0;
62  sigaction(signum, &sa, 0);
63 
64  return old_eh;
65 }
static EventHandler * signalHandlers_[NSIG]
static void dispatcher(int signum)

Here is the call graph for this function:

void SignalHandler::removeHandler ( int  signum)

Definition at line 67 of file signalhandler.cpp.

References signalHandlers_.

67  {
68  // EventHandler *old_eh = signalHandlers_[signum];
69  signalHandlers_[signum] = static_cast<EventHandler *>(0);
70 }
static EventHandler * signalHandlers_[NSIG]

Member Data Documentation

SignalHandler * SignalHandler::instance_ = NULL
staticprivate

Definition at line 90 of file signalhandler.h.

Referenced by dispatcher(), and instance().

EventHandler * SignalHandler::signalHandlers_
staticprivate

Definition at line 100 of file signalhandler.h.

Referenced by dispatcher(), registerHandler(), and removeHandler().


The documentation for this class was generated from the following files: