MySQL 8.0.39
Source Code Documentation
mysql_harness::WaitingQueueAdaptor< Q > Class Template Reference

provide waiting pop and push operator to thread-safe queues. More...

#include <waiting_queue_adaptor.h>

Public Types

using value_type = typename Q::value_type
 

Public Member Functions

value_type pop ()
 dequeue an item from a queue. More...
 
bool try_pop (value_type &item)
 dequeue an item from a queue if queue is not empty. More...
 
void push (const value_type &item)
 enqueue item into queue. More...
 
void push (value_type &&item)
 
bool try_push (const value_type &item)
 enqueue an item into a queue if queue is not full. More...
 

Private Member Functions

void notify_dequeueable ()
 
void notify_enqueueable ()
 

Private Attributes

q_
 
std::mutex dequeueable_cond_mutex_
 
std::condition_variable dequeueable_cond_
 
std::mutex enqueueable_cond_mutex_
 
std::condition_variable enqueueable_cond_
 

Detailed Description

template<class Q>
class mysql_harness::WaitingQueueAdaptor< Q >

provide waiting pop and push operator to thread-safe queues.

Member Typedef Documentation

◆ value_type

template<class Q >
using mysql_harness::WaitingQueueAdaptor< Q >::value_type = typename Q::value_type

Member Function Documentation

◆ notify_dequeueable()

template<class Q >
void mysql_harness::WaitingQueueAdaptor< Q >::notify_dequeueable ( )
inlineprivate

◆ notify_enqueueable()

template<class Q >
void mysql_harness::WaitingQueueAdaptor< Q >::notify_enqueueable ( )
inlineprivate

◆ pop()

template<class Q >
value_type mysql_harness::WaitingQueueAdaptor< Q >::pop ( )
inline

dequeue an item from a queue.

Waits until item becomes available.

Returns
item

◆ push() [1/2]

template<class Q >
void mysql_harness::WaitingQueueAdaptor< Q >::push ( const value_type item)
inline

enqueue item into queue.

waits until queue is not full anymore.

Parameters
itemitem to enqueue

◆ push() [2/2]

template<class Q >
void mysql_harness::WaitingQueueAdaptor< Q >::push ( value_type &&  item)
inline

◆ try_pop()

template<class Q >
bool mysql_harness::WaitingQueueAdaptor< Q >::try_pop ( value_type item)
inline

dequeue an item from a queue if queue is not empty.

Parameters
itemdequeued item if queue was not empty
Returns
item
Return values
trueitem dequeued
falsequeue was empty

◆ try_push()

template<class Q >
bool mysql_harness::WaitingQueueAdaptor< Q >::try_push ( const value_type item)
inline

enqueue an item into a queue if queue is not full.

Parameters
itemitem to enqueue
Returns
item
Return values
trueitem enqueued
falsequeue was full

Member Data Documentation

◆ dequeueable_cond_

template<class Q >
std::condition_variable mysql_harness::WaitingQueueAdaptor< Q >::dequeueable_cond_
private

◆ dequeueable_cond_mutex_

template<class Q >
std::mutex mysql_harness::WaitingQueueAdaptor< Q >::dequeueable_cond_mutex_
private

◆ enqueueable_cond_

template<class Q >
std::condition_variable mysql_harness::WaitingQueueAdaptor< Q >::enqueueable_cond_
private

◆ enqueueable_cond_mutex_

template<class Q >
std::mutex mysql_harness::WaitingQueueAdaptor< Q >::enqueueable_cond_mutex_
private

◆ q_

template<class Q >
Q mysql_harness::WaitingQueueAdaptor< Q >::q_
private

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