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

condition variable class. More...

#include <condition.hpp>

Public Member Functions

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

Detailed Description

condition variable class.

Constructor & Destructor Documentation

◆ Condition() [1/3]

Condition::Condition ( )

default constructor.

◆ Condition() [2/3]

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

copy constructor.

Parameters
otherother object to copy.

◆ Condition() [3/3]

join::Condition::Condition ( Condition && other)
delete

move constructor.

Parameters
otherother object to move.

◆ ~Condition()

Condition::~Condition ( )

destroys the mutex object.

Member Function Documentation

◆ broadcast()

void Condition::broadcast ( )
noexcept

unblocks all threads currently waiting.

◆ operator=() [1/2]

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

move assignment.

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

◆ operator=() [2/2]

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

copy assignment.

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

◆ signal()

void Condition::signal ( )
noexcept

unblocks one of the waiting threads.

◆ timedWait() [1/2]

template<class Lock , class Rep , class Period >
bool join::Condition::timedWait ( Lock & 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 Lock , class Rep , class Period , class Predicate >
bool join::Condition::timedWait ( Lock & 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]

template<class Lock >
void join::Condition::wait ( Lock & lock)
inline

wait on a condition.

Parameters
lockmutex previously locked by the calling thread.

◆ wait() [2/2]

template<class Lock , class Predicate >
void join::Condition::wait ( Lock & 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: