MySQL 26.7.0
Source Code Documentation
mysql::concurrency::Condition_variable_wrapper Class Reference

MySQL wrapper for a condition variable, using mysql_cond_t as implementation of a condition variable having interface of condition_variable provided by the STL. More...

#include <condition_variable_wrapper.h>

Public Member Functions

 Condition_variable_wrapper (PSI_cond_key key)
 
 ~Condition_variable_wrapper ()
 
template<class Predicate >
void wait (std::unique_lock< Mutex_wrapper > &lock, Predicate pred)
 Wait until notified or predicate is false. More...
 
template<class Rep , class Period , class Predicate >
bool wait_for (std::unique_lock< Mutex_wrapper > &lock, const std::chrono::duration< Rep, Period > &rel_time, Predicate pred)
 Wait for a relative timeout or until notified. More...
 
template<class Rep , class Period >
std::cv_status wait_for (std::unique_lock< Mutex_wrapper > &lock, const std::chrono::duration< Rep, Period > &rel_time)
 Wait for a relative timeout. More...
 
template<class Clock , class Duration , class Predicate >
bool wait_until (std::unique_lock< Mutex_wrapper > &lock, const std::chrono::time_point< Clock, Duration > &abs_time, Predicate pred)
 Wait until an absolute timeout or until notified. More...
 
template<class Clock , class Duration >
std::cv_status wait_until (std::unique_lock< Mutex_wrapper > &lock, const std::chrono::time_point< Clock, Duration > &abs_time)
 Wait until an absolute timeout. More...
 
void notify_one ()
 Notify one waiting thread. More...
 
void notify_all ()
 Notify all waiting threads. More...
 
void wait (std::unique_lock< Mutex_wrapper > &lock)
 Wait until notified. More...
 
 Condition_variable_wrapper (const Condition_variable_wrapper &)=delete
 
 Condition_variable_wrapper (Condition_variable_wrapper &&)=delete
 
Condition_variable_wrapperoperator= (const Condition_variable_wrapper &src)=delete
 
Condition_variable_wrapperoperator= (Condition_variable_wrapper &&src)=delete
 

Protected Attributes

mysql_cond_t m_cv
 

Detailed Description

MySQL wrapper for a condition variable, using mysql_cond_t as implementation of a condition variable having interface of condition_variable provided by the STL.

Constructor & Destructor Documentation

◆ Condition_variable_wrapper() [1/3]

mysql::concurrency::Condition_variable_wrapper::Condition_variable_wrapper ( PSI_cond_key  key)

◆ ~Condition_variable_wrapper()

mysql::concurrency::Condition_variable_wrapper::~Condition_variable_wrapper ( )

◆ Condition_variable_wrapper() [2/3]

mysql::concurrency::Condition_variable_wrapper::Condition_variable_wrapper ( const Condition_variable_wrapper )
delete

◆ Condition_variable_wrapper() [3/3]

mysql::concurrency::Condition_variable_wrapper::Condition_variable_wrapper ( Condition_variable_wrapper &&  )
delete

Member Function Documentation

◆ notify_all()

void mysql::concurrency::Condition_variable_wrapper::notify_all ( )

Notify all waiting threads.

◆ notify_one()

void mysql::concurrency::Condition_variable_wrapper::notify_one ( )

Notify one waiting thread.

◆ operator=() [1/2]

Condition_variable_wrapper & mysql::concurrency::Condition_variable_wrapper::operator= ( Condition_variable_wrapper &&  src)
delete

◆ operator=() [2/2]

Condition_variable_wrapper & mysql::concurrency::Condition_variable_wrapper::operator= ( const Condition_variable_wrapper src)
delete

◆ wait() [1/2]

void mysql::concurrency::Condition_variable_wrapper::wait ( std::unique_lock< Mutex_wrapper > &  lock)

Wait until notified.

Parameters
[in,out]lockUnique lock on the mutex to wait on

◆ wait() [2/2]

template<class Predicate >
void mysql::concurrency::Condition_variable_wrapper::wait ( std::unique_lock< Mutex_wrapper > &  lock,
Predicate  pred 
)

Wait until notified or predicate is false.

Template Parameters
PredicateType of the predicate function
Parameters
[in,out]lockUnique lock on the mutex to wait on
[in]predPredicate function to check

◆ wait_for() [1/2]

template<class Rep , class Period >
std::cv_status mysql::concurrency::Condition_variable_wrapper::wait_for ( std::unique_lock< Mutex_wrapper > &  lock,
const std::chrono::duration< Rep, Period > &  rel_time 
)

Wait for a relative timeout.

Template Parameters
RepRepresentation type of the duration
PeriodPeriod type of the duration
Parameters
[in,out]lockUnique lock on the mutex to wait on
[in]rel_timeRelative time to wait
Returns
cv_status indicating whether timeout occurred or not

◆ wait_for() [2/2]

template<class Rep , class Period , class Predicate >
bool mysql::concurrency::Condition_variable_wrapper::wait_for ( std::unique_lock< Mutex_wrapper > &  lock,
const std::chrono::duration< Rep, Period > &  rel_time,
Predicate  pred 
)

Wait for a relative timeout or until notified.

Template Parameters
RepRepresentation type of the duration
PeriodPeriod type of the duration
PredicateType of the predicate function
Parameters
[in,out]lockUnique lock on the mutex to wait on
[in]rel_timeRelative time to wait
[in]predPredicate function to check
Returns
True if predicate is true, false if timeout occurred

◆ wait_until() [1/2]

template<class Clock , class Duration >
std::cv_status mysql::concurrency::Condition_variable_wrapper::wait_until ( std::unique_lock< Mutex_wrapper > &  lock,
const std::chrono::time_point< Clock, Duration > &  abs_time 
)

Wait until an absolute timeout.

Template Parameters
ClockClock type for the time point
DurationDuration type for the time point
Parameters
[in,out]lockUnique lock on the mutex to wait on
[in]abs_timeAbsolute time to wait until
Returns
cv_status indicating whether timeout occurred or not

◆ wait_until() [2/2]

template<class Clock , class Duration , class Predicate >
bool mysql::concurrency::Condition_variable_wrapper::wait_until ( std::unique_lock< Mutex_wrapper > &  lock,
const std::chrono::time_point< Clock, Duration > &  abs_time,
Predicate  pred 
)

Wait until an absolute timeout or until notified.

Template Parameters
ClockClock type for the time point
DurationDuration type for the time point
PredicateType of the predicate function
Parameters
[in,out]lockUnique lock on the mutex to wait on
[in]abs_timeAbsolute time to wait until
[in]predPredicate function to check
Returns
True if predicate is true, false if timeout occurred

Member Data Documentation

◆ m_cv

mysql_cond_t mysql::concurrency::Condition_variable_wrapper::m_cv
protected

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