mxnet
Classes | Public Member Functions | List of all members
dmlc::ConcurrentBlockingQueue< T, type > Class Template Reference

Cocurrent blocking queue. More...

#include <concurrency.h>

Collaboration diagram for dmlc::ConcurrentBlockingQueue< T, type >:
Collaboration graph

Public Member Functions

 ConcurrentBlockingQueue ()
 
 ~ConcurrentBlockingQueue ()=default
 
template<typename E >
void Push (E &&e, int priority=0)
 Push element to the end of the queue. More...
 
template<typename E >
void PushFront (E &&e, int priority=0)
 Push element to the front of the queue. Only works for FIFO queue. For priority queue it is the same as Push. More...
 
bool Pop (T *rv)
 Pop element from the queue. More...
 
void SignalForKill ()
 Signal the queue for destruction. More...
 
size_t Size ()
 Get the size of the queue. More...
 

Detailed Description

template<typename T, ConcurrentQueueType type = ConcurrentQueueType::kFIFO>
class dmlc::ConcurrentBlockingQueue< T, type >

Cocurrent blocking queue.

Constructor & Destructor Documentation

template<typename T , ConcurrentQueueType type>
dmlc::ConcurrentBlockingQueue< T, type >::ConcurrentBlockingQueue ( )
template<typename T , ConcurrentQueueType type = ConcurrentQueueType::kFIFO>
dmlc::ConcurrentBlockingQueue< T, type >::~ConcurrentBlockingQueue ( )
default

Member Function Documentation

template<typename T , ConcurrentQueueType type>
bool dmlc::ConcurrentBlockingQueue< T, type >::Pop ( T *  rv)

Pop element from the queue.

Parameters
rvElement popped.
Returns
On false, the queue is exiting.

The element will be copied or moved into the object passed in.

template<typename T , ConcurrentQueueType type>
template<typename E >
void dmlc::ConcurrentBlockingQueue< T, type >::Push ( E &&  e,
int  priority = 0 
)

Push element to the end of the queue.

Parameters
eElement to push into.
prioritythe priority of the element, only used for priority queue. The higher the priority is, the better.
Template Parameters
Ethe element type

It will copy or move the element into the queue, depending on the type of the parameter.

template<typename T , ConcurrentQueueType type>
template<typename E >
void dmlc::ConcurrentBlockingQueue< T, type >::PushFront ( E &&  e,
int  priority = 0 
)

Push element to the front of the queue. Only works for FIFO queue. For priority queue it is the same as Push.

Parameters
eElement to push into.
prioritythe priority of the element, only used for priority queue. The higher the priority is, the better.
Template Parameters
Ethe element type

It will copy or move the element into the queue, depending on the type of the parameter.

template<typename T , ConcurrentQueueType type>
void dmlc::ConcurrentBlockingQueue< T, type >::SignalForKill ( )

Signal the queue for destruction.

After calling this method, all blocking pop call to the queue will return false.

template<typename T , ConcurrentQueueType type>
size_t dmlc::ConcurrentBlockingQueue< T, type >::Size ( )

Get the size of the queue.

Returns
The size of the queue.

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