libDwm-0.6.0
Dwm::Pthread::Signal Class Reference

This class inherits from Dwm::Signal and adds locking and unlocking for threaded programs as well as members to block and unblock a in a particular thread (wrappers for pthread_sigmask()). More...

#include <DwmPthreadSignal.hh>

Inheritance diagram for Dwm::Pthread::Signal:
Collaboration diagram for Dwm::Pthread::Signal:

Public Member Functions

 Signal (int sigNum)
 Constructs from a signal number (e.g. SIGHUP).
 
bool Lock ()
 Attempts to lock the Signal object. More...
 
bool Unlock ()
 Attempts to unlock the Signal object. More...
 
bool BlockInThread ()
 Attempts to block the signal in the caller's thread. More...
 
bool UnblockInThread ()
 Attempts to unblock the signal in the caller's thread. More...
 
- Public Member Functions inherited from Dwm::Signal
 Signal (int sigNum)
 Construct from a signal number (e.g. SIGHUP).
 
 Signal (const Signal &signal)
 Copy constructor.
 
bool Block ()
 Block the signal.
 
bool Unblock ()
 Unblock the signal.
 
bool IsBlocked ()
 Returns true if the signal is currently blocked.
 
bool IsPending ()
 Returns true if the signal is currently pending.
 
void Wait ()
 Waits for the delivery of the signal to the calling thread. More...
 
int PushHandler (void(*handler)(int))
 Pushes a signal onto the top of a stack of signal handlers for the signal. More...
 
int PopHandler ()
 Pops the top signal handler off of the stack of signal handlers.
 
const std::string & Name () const
 Returns a string representation of the signal ("e.g. "SIGHUP").
 

Protected Attributes

Mutex _mutex
 
- Protected Attributes inherited from Dwm::Signal
int _sigNum
 
std::deque< void(*)(int)> _handlers
 

Additional Inherited Members

- Static Protected Member Functions inherited from Dwm::Signal
static void FillNames ()
 
- Static Protected Attributes inherited from Dwm::Signal
static std::map< int, std::string, std::less< int > > _names
 

Detailed Description

This class inherits from Dwm::Signal and adds locking and unlocking for threaded programs as well as members to block and unblock a in a particular thread (wrappers for pthread_sigmask()).

Note that no members perform automatic locking; you must call Lock() and Unlock() explicitly to lock and unlock the Signal.

Member Function Documentation

◆ BlockInThread()

bool Dwm::Pthread::Signal::BlockInThread ( )

Attempts to block the signal in the caller's thread.

This is just a wrapper for pthread_sigmask(). Returns true on success, false on failure.

◆ Lock()

bool Dwm::Pthread::Signal::Lock ( )

Attempts to lock the Signal object.

Returns true on success, false on failure.

◆ UnblockInThread()

bool Dwm::Pthread::Signal::UnblockInThread ( )

Attempts to unblock the signal in the caller's thread.

This is just a wrapper for pthread_sigmask(). Returns true on success, false on failure.

◆ Unlock()

bool Dwm::Pthread::Signal::Unlock ( )

Attempts to unlock the Signal object.

Returns true on success, false on failure.


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