CernVM-FS
2.12.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 305 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 180 of file concurrency_impl.h.
|
virtual |
Definition at line 198 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 223 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 245 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 206 of file concurrency_impl.h.
|
inline |
Definition at line 261 of file concurrency_impl.h.
|
inline |
Definition at line 275 of file concurrency_impl.h.
|
inline |
Definition at line 268 of file concurrency_impl.h.
|
private |
Definition at line 348 of file concurrency.h.
|
mutableprivate |
Definition at line 352 of file concurrency.h.
Referenced by FifoChannel< T >::FifoChannel().
|
private |
Definition at line 349 of file concurrency.h.
|
mutableprivate |
Definition at line 353 of file concurrency.h.
Referenced by FifoChannel< T >::FifoChannel().
|
mutableprivate |
Definition at line 354 of file concurrency.h.
Referenced by FifoChannel< T >::FifoChannel().