![]() |
CernVM-FS
2.13.0
|
#include <concurrency.h>
Public Member Functions | |
FifoChannel (const size_t maximal_length, const size_t drainout_threshold) | |
virtual | ~FifoChannel () |
void | Enqueue (const T &data) |
const T | Dequeue () |
unsigned int | Drop () |
size_t | GetItemCount () const |
bool | IsEmpty () const |
size_t | GetMaximalItemCount () const |
Private Attributes | |
const size_t | maximal_queue_length_ |
const size_t | queue_drainout_threshold_ |
pthread_mutex_t | mutex_ |
pthread_cond_t | queue_is_not_empty_ |
pthread_cond_t | queue_is_not_full_ |
Asynchronous FIFO channel template Implements a thread safe FIFO queue that handles thread blocking if the queue is full or empty.
T | the data type to be enqueued in the queue |
Definition at line 383 of file concurrency.h.
FifoChannel< T >::FifoChannel | ( | const size_t | maximal_length, |
const size_t | drainout_threshold | ||
) |
Creates a new FIFO channel.
maximal_length | the maximal number of items that can be enqueued |
drainout_threshold | if less than xx elements are in the queue it is considered to be "not full" |
Definition at line 177 of file concurrency_impl.h.
|
virtual |
Definition at line 194 of file concurrency_impl.h.
const T FifoChannel< T >::Dequeue | ( | ) |
Removes the next element from the channel. If the queue is empty, this will block until another thread enqueues an item into the channel.
Definition at line 219 of file concurrency_impl.h.
unsigned int FifoChannel< T >::Drop | ( | ) |
Clears all items in the FIFO channel. The cleared items will be lost.
Definition at line 242 of file concurrency_impl.h.
void FifoChannel< T >::Enqueue | ( | const T & | data | ) |
Adds a new item to the end of the FIFO channel. If the queue is full, this call will block until items were dequeued by another thread allowing the desired insertion.
data | the data to be enqueued into the FIFO channel |
Definition at line 202 of file concurrency_impl.h.
|
inline |
Definition at line 258 of file concurrency_impl.h.
|
inline |
Definition at line 272 of file concurrency_impl.h.
|
inline |
Definition at line 265 of file concurrency_impl.h.
|
private |
Definition at line 425 of file concurrency.h.
|
mutableprivate |
Definition at line 429 of file concurrency.h.
Referenced by FifoChannel< T >::FifoChannel().
|
private |
Definition at line 426 of file concurrency.h.
|
mutableprivate |
Definition at line 430 of file concurrency.h.
Referenced by FifoChannel< T >::FifoChannel().
|
mutableprivate |
Definition at line 431 of file concurrency.h.
Referenced by FifoChannel< T >::FifoChannel().