MySQL  8.0.19
Source Code Documentation
Synchronized_queue< T > Class Template Reference

#include <plugin_utils.h>

Inheritance diagram for Synchronized_queue< T >:
Synchronized_queue_interface< T > Abortable_synchronized_queue< T >

Public Member Functions

 Synchronized_queue ()
 
virtual ~Synchronized_queue ()
 
bool empty ()
 Checks if the queue is empty. More...
 
virtual bool push (const T &value)
 Inserts an element in the queue. More...
 
virtual bool pop (T *out)
 Fetches the front of the queue and removes it. More...
 
virtual bool pop ()
 Pops the front of the queue removing it. More...
 
virtual bool front (T *out)
 Fetches the front of the queue but does not remove it. More...
 
size_t size ()
 Checks the queue size. More...
 
- Public Member Functions inherited from Synchronized_queue_interface< T >
virtual ~Synchronized_queue_interface ()
 

Protected Attributes

mysql_mutex_t lock
 
mysql_cond_t cond
 
std::queue< T > queue
 

Constructor & Destructor Documentation

◆ Synchronized_queue()

template<typename T >
Synchronized_queue< T >::Synchronized_queue ( )
inline

◆ ~Synchronized_queue()

template<typename T >
virtual Synchronized_queue< T >::~Synchronized_queue ( )
inlinevirtual

Member Function Documentation

◆ empty()

template<typename T >
bool Synchronized_queue< T >::empty ( )
inlinevirtual

Checks if the queue is empty.

Returns
if is empty
Return values
trueempty
falsenot empty

Implements Synchronized_queue_interface< T >.

◆ front()

template<typename T >
virtual bool Synchronized_queue< T >::front ( T *  out)
inlinevirtual

Fetches the front of the queue but does not remove it.

Note
The method will block if the queue is empty until a element is pushed
Parameters
outThe fetched reference.
Returns
false, operation always succeeded

Implements Synchronized_queue_interface< T >.

Reimplemented in Abortable_synchronized_queue< T >, and Abortable_synchronized_queue< Group_service_message * >.

◆ pop() [1/2]

template<typename T >
virtual bool Synchronized_queue< T >::pop ( )
inlinevirtual

Pops the front of the queue removing it.

Note
The method will block if the queue is empty until a element is pushed
Returns
true if method was aborted, false otherwise

Implements Synchronized_queue_interface< T >.

Reimplemented in Abortable_synchronized_queue< T >, and Abortable_synchronized_queue< Group_service_message * >.

◆ pop() [2/2]

template<typename T >
virtual bool Synchronized_queue< T >::pop ( T *  out)
inlinevirtual

Fetches the front of the queue and removes it.

Note
The method will block if the queue is empty until a element is pushed
Parameters
outThe fetched reference.
Returns
false, operation always succeeded

Implements Synchronized_queue_interface< T >.

Reimplemented in Abortable_synchronized_queue< T >, and Abortable_synchronized_queue< Group_service_message * >.

◆ push()

template<typename T >
virtual bool Synchronized_queue< T >::push ( const T &  value)
inlinevirtual

Inserts an element in the queue.

Alerts any other thread lock on pop() or front()

Parameters
valueThe value to insert
Returns
false, operation always succeeded

Implements Synchronized_queue_interface< T >.

Reimplemented in Abortable_synchronized_queue< T >, and Abortable_synchronized_queue< Group_service_message * >.

◆ size()

template<typename T >
size_t Synchronized_queue< T >::size ( )
inlinevirtual

Checks the queue size.

Returns
the size of the queue

Implements Synchronized_queue_interface< T >.

Member Data Documentation

◆ cond

template<typename T >
mysql_cond_t Synchronized_queue< T >::cond
protected

◆ lock

template<typename T >
mysql_mutex_t Synchronized_queue< T >::lock
protected

◆ queue

template<typename T >
std::queue<T> Synchronized_queue< T >::queue
protected

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