trantor
Non-blocking I/O cross-platform TCP network library, using C++14
Loading...
Searching...
No Matches
trantor::MpscQueue< T > Class Template Reference

This class template represents a lock-free multiple producers single consumer queue. More...

#include <trantor/utils/LockFreeQueue.h>

Inheritance diagram for trantor::MpscQueue< T >:
Collaboration diagram for trantor::MpscQueue< T >:

Public Member Functions

void enqueue (T &&input)
 Put a item into the queue.
void enqueue (const T &input)
bool dequeue (T &output)
 Get a item from the queue.
bool empty ()

Additional Inherited Members

Protected Member Functions inherited from trantor::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete
 NonCopyable (NonCopyable &&) noexcept(true)=default
NonCopyable & operator= (NonCopyable &&) noexcept(true)=default

Detailed Description

template<typename T>
class trantor::MpscQueue< T >

This class template represents a lock-free multiple producers single consumer queue.

Template Parameters
TThe type of the items in the queue.

Member Function Documentation

◆ dequeue()

template<typename T>
bool trantor::MpscQueue< T >::dequeue ( T & output)
inline

Get a item from the queue.

Parameters
output
Returns
false if the queue is empty.
Note
This method must be called in a single thread.

◆ enqueue()

template<typename T>
void trantor::MpscQueue< T >::enqueue ( T && input)
inline

Put a item into the queue.

Parameters
input
Note
This method can be called in multiple threads.

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