join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::SharedCondition Class Reference

condition variable class for shared memory. More...

#include <condition.hpp>

Public Member Functions

 SharedCondition ()
 default constructor.
 
 SharedCondition (const SharedCondition &other)=delete
 copy constructor.
 
SharedConditionoperator= (const SharedCondition &other)=delete
 copy assignment.
 
 SharedCondition (SharedCondition &&other)=delete
 move constructor.
 
SharedConditionoperator= (SharedCondition &&other)=delete
 move assignment.
 
 ~SharedCondition ()
 destroys the mutex object.
 
void signal () noexcept
 unblocks one of the waiting threads.
 
void broadcast () noexcept
 unblocks all threads currently waiting.
 
void wait (ScopedLock< SharedMutex > &lock)
 wait on a condition.
 
template<class Predicate >
void wait (ScopedLock< SharedMutex > &lock, Predicate pred)
 wait on a condition with predicate.
 
template<class Rep , class Period >
bool timedWait (ScopedLock< SharedMutex > &lock, std::chrono::duration< Rep, Period > timeout)
 wait on a condition until timeout expire.
 
template<class Rep , class Period , class Predicate >
bool timedWait (ScopedLock< SharedMutex > &lock, std::chrono::duration< Rep, Period > timeout, Predicate pred)
 wait on a condition with predicate until timeout expire.
 

Detailed Description

condition variable class for shared memory.

Constructor & Destructor Documentation

◆ SharedCondition() [1/3]

SharedCondition::SharedCondition ( )

default constructor.

◆ SharedCondition() [2/3]

join::SharedCondition::SharedCondition ( const SharedCondition & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ SharedCondition() [3/3]

join::SharedCondition::SharedCondition ( SharedCondition && other)
delete

move constructor.

Parameters
otherother object to move.

◆ ~SharedCondition()

SharedCondition::~SharedCondition ( )

destroys the mutex object.

Member Function Documentation

◆ broadcast()

void SharedCondition::broadcast ( )
noexcept

unblocks all threads currently waiting.

◆ operator=() [1/2]

SharedCondition & join::SharedCondition::operator= ( const SharedCondition & other)
delete

copy assignment.

Parameters
otherother object to copy.
Returns
a reference to the current object.

◆ operator=() [2/2]

SharedCondition & join::SharedCondition::operator= ( SharedCondition && other)
delete

move assignment.

Parameters
otherother object to move.
Returns
a reference to the current object.

◆ signal()

void SharedCondition::signal ( )
noexcept

unblocks one of the waiting threads.

◆ timedWait() [1/2]

template<class Rep , class Period >
bool join::SharedCondition::timedWait ( ScopedLock< SharedMutex > & lock,
std::chrono::duration< Rep, Period > timeout )
inline

wait on a condition until timeout expire.

Parameters
lockmutex previously locked by the calling thread.
timeouttimeout.
Returns
true on success, false on timeout.

◆ timedWait() [2/2]

template<class Rep , class Period , class Predicate >
bool join::SharedCondition::timedWait ( ScopedLock< SharedMutex > & lock,
std::chrono::duration< Rep, Period > timeout,
Predicate pred )
inline

wait on a condition with predicate until timeout expire.

Parameters
lockmutex previously locked by the calling thread.
timeouttimeout.
predpredicate.
Returns
true on success, false on timeout.

◆ wait() [1/2]

void SharedCondition::wait ( ScopedLock< SharedMutex > & lock)

wait on a condition.

Parameters
lockmutex previously locked by the calling thread.

◆ wait() [2/2]

template<class Predicate >
void join::SharedCondition::wait ( ScopedLock< SharedMutex > & lock,
Predicate pred )
inline

wait on a condition with predicate.

Parameters
lockmutex previously locked by the calling thread.
predpredicate.

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