Loading...
Searching...
No Matches
SigHandler.h
Go to the documentation of this file.
// -*- c++ -*-
//------------------------------------------------------------------------------
// SigHandler.h
//------------------------------------------------------------------------------
// Copyright (c) 1997 by Vladislav Grinchenko
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//------------------------------------------------------------------------------
#ifndef _SigHandler_h
#define _SigHandler_h
// System includes
#include <signal.h>
#include <errno.h>
#include "assa/Logger.h"
#include "assa/IdSet.h"
#include "assa/SigSet.h"
#include "assa/SigAction.h"
#include "assa/EventHandler.h"
namespace ASSA {
#if !defined(WIN32)
class SigHandler
{
public:
virtual ~SigHandler () { /* no-op */ }
virtual int install (int signum_,
EventHandler* new_hand_,
SigAction* new_disp_ = 0,
EventHandler** old_hand_ = 0,
SigAction* old_disp_ = 0);
virtual int remove (int signum_,
EventHandler* eh_ = 0,
SigAction* new_disp_ = 0,
SigAction* old_disp_ = 0);
static void dispatch (int signum_);
EventHandler* handler (int signum_, EventHandler* new_);
EventHandler* handler (int signum_);
protected:
int in_range(int signum_);
private:
static EventHandler* m_signal_handlers [NSIG];
};
#endif // !defined(WIN32)
} // end namespace ASSA
#endif /* _SigHandler_h */
EventHandler.h
An abstract interface for handling I/O events, timers, and such.
IdSet.h
Class IdSet implements a set of reusable unique IDs, up to 1024.
Logger.h
An abstraction to message logging facility.
SigAction.h
SigAction is a C++ wrapper around sigaction structure.
SigSet.h
SigSet is a wrapper for UNIX sigset_t structure that provides all manipulators on this structure as w...
ASSA::AutoPtrRef
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
ASSA::EventHandler
EventHandler class.
Definition EventHandler.h:103
ASSA::SigAction
Definition SigAction.h:95
ASSA::SigHandler
Definition SigHandler.h:50
ASSA::SigHandler::m_signal_handlers
static EventHandler * m_signal_handlers[NSIG]
Static array that stores one user-defined event handler pointer for every signal.
Definition SigHandler.h:127
ASSA::SigHandler::remove
virtual int remove(int signum_, EventHandler *eh_=0, SigAction *new_disp_=0, SigAction *old_disp_=0)
Remove EventHandler associated with signum_.
Definition SigHandler.cpp:107
ASSA::SigHandler::~SigHandler
virtual ~SigHandler()
No-op virtual destructor.
Definition SigHandler.h:54
ASSA::SigHandler::dispatch
static void dispatch(int signum_)
Here is the heart of SigHandler class.
Definition SigHandler.cpp:130
ASSA::SigHandler::in_range
int in_range(int signum_)
Check that signum_ is in valid range.
Definition SigHandler.cpp:27
ASSA::SigHandler::handler
EventHandler * handler(int signum_, EventHandler *new_)
Set new event handler for signal signum_ and return an existing one.
Definition SigHandler.cpp:42
ASSA::SigHandler::install
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.
Definition SigHandler.cpp:70
ASSA
Definition Acceptor.h:40