LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Private Attributes
LogCabin::Event::Signal::Blocker Class Reference

Blocks asynchronous signal delivery on the current thread for the given signal. More...

#include <Signal.h>

List of all members.

Public Member Functions

 Blocker (int signalNumber)
 Constructor.
 ~Blocker ()
 Destructor.
void block ()
 Blocks further signals if they are not already blocked.
void leaveBlocked ()
 Leave the signal blocked when this object is destroyed.
void unblock ()
 Unblocks signals if they are blocked.

Public Attributes

const int signalNumber

Private Attributes

bool isBlocked
 Set to true if the signal is currently blocked.
bool shouldLeaveBlocked
 Set to true if the signal should be left unblocked on destruction.

Detailed Description

Blocks asynchronous signal delivery on the current thread for the given signal.

This should normally be called before any secondary threads are started, so that all subsequent threads also have the signal blocked.

Warning:
This class is not thread-safe: the caller must use an external mutex or (more commonly) may only manipulate this class while a single thread is running.

Definition at line 48 of file Signal.h.


Constructor & Destructor Documentation

LogCabin::Event::Signal::Blocker::Blocker ( int  signalNumber) [explicit]

Constructor.

Masks asynchronous signal delivery for signalNumber.

Definition at line 51 of file Signal.cc.

Destructor.

Unmasks asynchronous signal delivery for signalNumber.

Definition at line 59 of file Signal.cc.


Member Function Documentation

Blocks further signals if they are not already blocked.

Definition at line 66 of file Signal.cc.

Leave the signal blocked when this object is destroyed.

Definition at line 82 of file Signal.cc.

Unblocks signals if they are blocked.

Also clears shouldLeaveBlocked.

Definition at line 88 of file Signal.cc.


Member Data Documentation

Definition at line 72 of file Signal.h.

Set to true if the signal is currently blocked.

Definition at line 77 of file Signal.h.

Set to true if the signal should be left unblocked on destruction.

Definition at line 81 of file Signal.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines