Template Class Queue¶
Defined in File queue.h
A basic locked, blocking MPMC queue.
popis guarded by a mutex. A condition variable is used to communicate insertion of new elements, such that waiting threads will be woken up if they are currently waiting inside a call to
Note that this data structure is written specifically for use with the
DataLoader. Its behavior is tailored to this use case and may not be applicable to more general uses.
Pushes a new value to the back of the
Queueand notifies one thread on the waiting side about this event.
pop(optional<std::chrono::milliseconds> timeout = nullopt)¶
Blocks until at least one element is ready to be popped from the front of the queue.
timeoutin seconds can be used to limit the time spent waiting for an element. If the wait times out, an exception is raised.
Empties the queue and returns the number of elements that were present at the start of the function.
No threads are notified about this event as it is assumed to be used to drain the queue during shutdown of a