senf::scheduler::SignalEvent Class Reference

UNIX signal event. More...

#include <senf/Scheduler/SignalEvent.hh>

Inheritance diagram for senf::scheduler::SignalEvent:

Public Types

typedef boost::function< void(siginfo_t const &)> Callback
 Callback type. More...
 
- Public Types inherited from senf::scheduler::detail::FIFORunner::TaskInfo
enum  Priority { PRIORITY_LOW = 0, PRIORITY_NORMAL = 1, PRIORITY_HIGH = 2 }
 

Public Member Functions

void disable ()
 Enable signal event registration. More...
 
void enable ()
 Disable the signal event registration. More...
 
void action (Callback const &cb)
 Change signal event callback. More...
 
- Public Member Functions inherited from senf::scheduler::detail::FIFORunner::TaskInfo
 TaskInfo (std::string const &name, Priority priority=PRIORITY_NORMAL)
 
virtual ~TaskInfo ()
 
void run ()
 
bool runnable () const
 
- Public Member Functions inherited from senf::scheduler::detail::Event
std::string const & name () const
 Get event name. More...
 
bool enabled () const
 true, if event is enabled, false otherwise More...
 
unsigned runCount () const
 Number of times, event was fired. More...
 
char const * type () const
 Event type code. More...
 
std::string info () const
 Additional event information. More...
 
 Event (std::string const &name)
 
virtual ~Event ()
 

Structors and default members

 SignalEvent (int signal, Callback const &cb, bool initiallyEnabled=true)
 Register a signal event. More...
 
 ~SignalEvent ()
 

Additional Inherited Members

- Protected Member Functions inherited from senf::scheduler::detail::FIFORunner::TaskInfo
void setRunnable ()
 
- Protected Member Functions inherited from senf::scheduler::detail::Event
void countRun ()
 

Detailed Description

UNIX signal event.

The SignalEvent class registers a callback for UNIX signals. The callback will be called synchronously (not from within the UNIX signal handler) by the scheduler.

The SignalEvent class is an implementation of the RAII idiom: The event will be automatically unregistered in the SignalEvent destructor. The SignalEvent instance should be created within the same scope or on a scope below where the callback is defined (e.g. if the callback is a member function it should be defined as a class member).

Definition at line 53 of file SignalEvent.hh.

Member Typedef Documentation

◆ Callback

typedef boost::function<void (siginfo_t const &)> senf::scheduler::SignalEvent::Callback

Callback type.

Definition at line 61 of file SignalEvent.hh.

Constructor & Destructor Documentation

◆ SignalEvent()

senf::scheduler::SignalEvent::SignalEvent ( int  signal,
Callback const &  cb,
bool  initiallyEnabled = true 
)

Register a signal event.

Registers cb as callback for the UNIX signal signal. If initiallyEnabled is set false, the callback will not be enabled automatically. Use enable() to do so.

Parameters
[in]signalUNIX signal to register callback for
[in]cbCallback to call
[in]initiallyEnabledif set false, do not enable callback automatically.

◆ ~SignalEvent()

senf::scheduler::SignalEvent::~SignalEvent ( )

Member Function Documentation

◆ action()

void senf::scheduler::SignalEvent::action ( Callback const &  cb)

Change signal event callback.

◆ disable()

void senf::scheduler::SignalEvent::disable ( )

Enable signal event registration.

◆ enable()

void senf::scheduler::SignalEvent::enable ( )

Disable the signal event registration.


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