pstore2
Public Member Functions | List of all members
pstore::descriptor_condition_variable Class Reference

On POSIX, This class implements the "self pipe trick" to enable a signal handler to call notify() to wake up a thread waiting on wait(). More...

#include <signal_cv.hpp>

Public Member Functions

 descriptor_condition_variable (descriptor_condition_variable const &)=delete
 
 descriptor_condition_variable (descriptor_condition_variable &&)=delete
 
descriptor_condition_variableoperator= (descriptor_condition_variable const &)=delete
 
descriptor_condition_variableoperator= (descriptor_condition_variable &&)=delete
 
void notify_all ()
 Unblocks all threads currently waiting for *this.
 
void notify_all_no_except () noexcept
 Unblocks all threads currently waiting for *this. More...
 
void wait (std::unique_lock< std::mutex > &lock)
 Releases lock and blocks the current executing thread. More...
 
void wait ()
 
pipe_descriptor const & wait_descriptor () const noexcept
 
void reset ()
 

Detailed Description

On POSIX, This class implements the "self pipe trick" to enable a signal handler to call notify() to wake up a thread waiting on wait().

On Windows, an Event object is used to provide similar condition-variable like behavior.

Member Function Documentation

◆ notify_all_no_except()

void pstore::descriptor_condition_variable::notify_all_no_except ( )
noexcept

Unblocks all threads currently waiting for *this.

Note
On POSIX, this function is called from a signal handler. It must only call signal-safe functions.

◆ wait()

void pstore::descriptor_condition_variable::wait ( std::unique_lock< std::mutex > &  lock)

Releases lock and blocks the current executing thread.

The thread will be unblocked when notify() is executed. When unblocked, lock is reacquired and wait exits.

Parameters
lockAn object of type std::unique_lock<std::mutex>, which must be locked by the current thread

OCLINT(PH - variable is intentionally unused)


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