![]() |
VisionWorks Toolkit ReferenceDecember 18, 2015 | 1.2 Release |
Thread-Safe Queue
class.
Definition at line 67 of file ThreadSafeQueue.hpp.
Public Member Functions | |
void | clear () |
Removes all elements from the queue. More... | |
bool | pop (T &item, unsigned int timeout=1) |
Attemps to pop the oldest value from the queue. More... | |
bool | push (const T &item, unsigned int timeout=1) |
Attemps to push a new value into the queue. More... | |
ThreadSafeQueue (std::size_t maxSize) | |
Creation of a thread-safe queue with a specified capacity. More... | |
Protected Member Functions | |
ThreadSafeQueue & | operator= (const ThreadSafeQueue &) |
ThreadSafeQueue (const ThreadSafeQueue &) | |
Protected Attributes | |
std::condition_variable | condNonEmpty |
std::condition_variable | condNonFull |
std::size_t | maxSize |
std::mutex | mutex |
std::queue< T > | queue |
|
inlineexplicit |
Creation of a thread-safe queue with a specified capacity.
[in] | maxSize | A capacity of a queue. |
Definition at line 76 of file ThreadSafeQueue.hpp.
|
protected |
|
inline |
Attemps to push a new value into the queue.
[in] | item | A new value to push into the queue. |
[in] | timeout | A maximum timeout in ms that the method should be waiting while the queue is full. |
true
in case of a new element has been pushed into the queue. Otherwise the method returns false
. Definition at line 88 of file ThreadSafeQueue.hpp.
References nvxio::ThreadSafeQueue< T >::condNonEmpty, nvxio::ThreadSafeQueue< T >::condNonFull, nvxio::ThreadSafeQueue< T >::maxSize, nvxio::ThreadSafeQueue< T >::mutex, and nvxio::ThreadSafeQueue< T >::queue.
|
inline |
Attemps to pop the oldest value from the queue.
[out] | item | The oldest value of the queue. It will not be assinged if the queue is empty. |
[in] | timeout | A maximum timeout in ms that the method should be waiting while the queue is empty. |
true
in case of the oldest element has been popped from the queue. Otherwise the method returns false
. Definition at line 113 of file ThreadSafeQueue.hpp.
References nvxio::ThreadSafeQueue< T >::condNonEmpty, nvxio::ThreadSafeQueue< T >::condNonFull, nvxio::ThreadSafeQueue< T >::mutex, and nvxio::ThreadSafeQueue< T >::queue.
|
inline |
Removes all elements from the queue.
Definition at line 133 of file ThreadSafeQueue.hpp.
References nvxio::ThreadSafeQueue< T >::condNonFull, nvxio::ThreadSafeQueue< T >::mutex, and nvxio::ThreadSafeQueue< T >::queue.
|
protected |
|
protected |
Definition at line 144 of file ThreadSafeQueue.hpp.
Referenced by nvxio::ThreadSafeQueue< T >::clear(), nvxio::ThreadSafeQueue< T >::pop(), and nvxio::ThreadSafeQueue< T >::push().
|
protected |
Definition at line 145 of file ThreadSafeQueue.hpp.
Referenced by nvxio::ThreadSafeQueue< T >::push().
|
protected |
Definition at line 147 of file ThreadSafeQueue.hpp.
Referenced by nvxio::ThreadSafeQueue< T >::clear(), nvxio::ThreadSafeQueue< T >::pop(), and nvxio::ThreadSafeQueue< T >::push().
|
protected |
Definition at line 148 of file ThreadSafeQueue.hpp.
Referenced by nvxio::ThreadSafeQueue< T >::pop(), and nvxio::ThreadSafeQueue< T >::push().
|
protected |
Definition at line 148 of file ThreadSafeQueue.hpp.
Referenced by nvxio::ThreadSafeQueue< T >::clear(), nvxio::ThreadSafeQueue< T >::pop(), and nvxio::ThreadSafeQueue< T >::push().