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

Abortable synchronized queue extends synchronized queue allowing to abort methods waiting for elements on queue. More...

#include <plugin_utils.h>

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

Public Member Functions

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

Private Attributes

bool m_abort
 

Additional Inherited Members

- Protected Attributes inherited from Synchronized_queue< T >
mysql_mutex_t lock
 
mysql_cond_t cond
 
std::queue< T > queue
 

Detailed Description

template<typename T>
class Abortable_synchronized_queue< T >

Abortable synchronized queue extends synchronized queue allowing to abort methods waiting for elements on queue.

Constructor & Destructor Documentation

◆ Abortable_synchronized_queue()

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

◆ ~Abortable_synchronized_queue()

template<typename T >
Abortable_synchronized_queue< T >::~Abortable_synchronized_queue ( )
inline

Member Function Documentation

◆ abort()

template<typename T >
void Abortable_synchronized_queue< T >::abort ( )
inline

Remove all elements, abort current and future waits on retrieving elements from queue.

◆ front()

template<typename T >
bool Abortable_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 or abort is executed
Parameters
outThe fetched reference.
Returns
true if method was aborted, false otherwise

Reimplemented from Synchronized_queue< T >.

◆ pop() [1/2]

template<typename T >
bool Abortable_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 or abort is executed
Returns
false, operation always succeeded

Reimplemented from Synchronized_queue< T >.

◆ pop() [2/2]

template<typename T >
bool Abortable_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 or abort is executed
Parameters
outThe fetched reference.
Returns
true if method was aborted, false otherwise

Reimplemented from Synchronized_queue< T >.

◆ push()

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

Inserts an element in the queue.

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

Note
The method will not push if abort was executed.
Parameters
valueThe value to insert
Returns
false, operation always succeeded

Reimplemented from Synchronized_queue< T >.

Member Data Documentation

◆ m_abort

template<typename T >
bool Abortable_synchronized_queue< T >::m_abort
private

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