This class extends boost::lockfree::spsc_queue to implement event queues that one thread fills while another one empties, with no locks. For more information, please refer here.
More...
#include <concurrent_queue.hpp>
|
| | ConcurrentQueue_ (const std::size_t capacity) |
| | Construct the queue.
|
|
void | clear () |
| | Remove every event.
|
| bool | empty () const |
| | Check if the queue holds no events.
|
| bool | full () const |
| | Check if the queue holds as many events as it can.
|
| std::size_t | size () const |
| | Number of events in the queue.
|
| std::size_t | capacity () const |
| | Number of events the queue can hold.
|
template<typename T>
class ev::ConcurrentQueue_< T >
This class extends boost::lockfree::spsc_queue to implement event queues that one thread fills while another one empties, with no locks. For more information, please refer here.
Concurrent event queues inherit all the properties from boost single-producer single-consumer queues, so they are FIFO structures of fixed capacity that cannot be iterated. push() and full() belong to the thread that fills the queue, and front(), pop() and clear() to the thread that empties it. empty(), size() and capacity() can be used by both.
- Note
- Unlike event circular buffers, a full queue does not overwrite its oldest event: push() returns false and the event is not added, so no event is ever lost between the two threads.
-
At most one thread may push and at most one thread may pop.
Analogously to OpenCV library, the following aliases are defined for convenience:
ConcurrentQueue_(const std::size_t capacity)
Construct the queue.
Definition concurrent_queue.hpp:44
ConcurrentQueue_< long > ConcurrentQueuel
Definition concurrent_queue.hpp:90
ConcurrentQueue_< double > ConcurrentQueued
Definition concurrent_queue.hpp:92
ConcurrentQueuei ConcurrentQueue
Definition concurrent_queue.hpp:93
ConcurrentQueue_< int > ConcurrentQueuei
Definition concurrent_queue.hpp:89
ConcurrentQueue_< float > ConcurrentQueuef
Definition concurrent_queue.hpp:91
◆ ConcurrentQueue_()
Construct the queue.
- Parameters
-
| capacity | Number of events the queue can hold |
◆ capacity()
Number of events the queue can hold.
- Returns
- Capacity
◆ empty()
Check if the queue holds no events.
- Returns
- True if empty
◆ full()
Check if the queue holds as many events as it can.
- Returns
- True if full
◆ size()
Number of events in the queue.
- Returns
- Number of events
The documentation for this class was generated from the following file: