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

#include <plugin_utils.h>

Inheritance diagram for Synchronized_queue< T >:
[legend]

Public Member Functions

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

Protected Attributes

mysql_mutex_t lock
 
mysql_cond_t cond
 
std::queue< T, std::list< T, Malloc_allocator< T > > > queue
 

Constructor & Destructor Documentation

◆ Synchronized_queue()

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

◆ ~Synchronized_queue()

template<typename T >
Synchronized_queue< T >::~Synchronized_queue ( )
inlineoverride

Member Function Documentation

◆ empty()

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

Checks if the queue is empty.

Returns
if is empty
Return values
trueempty
falsenot empty

Implements Synchronized_queue_interface< T >.

◆ front()

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

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 >.

◆ pop() [1/2]

template<typename T >
bool Synchronized_queue< T >::pop ( )
inlineoverridevirtual

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 >.

◆ pop() [2/2]

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

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 >.

◆ push()

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

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 >.

◆ size()

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

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, std::list<T, Malloc_allocator<T> > > Synchronized_queue< T >::queue
protected

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