QcMailbox Class
template <typename T> class QcMailboxThread-safe hand-over of values of the type T from producer threads to one consumer. More...
| Header: | #include <common/core/QcMailbox.h> |
Public Functions
Detailed Description
Uses std::mutex on purpose: ThreadSanitizer sees its happens-before edges, unlike Qt's event queue inside the uninstrumented QtCore. push() reports whether the box was empty, so the producer wakes the consumer only once per batch.
Member Function Documentation
bool QcMailbox::push(T value)
Adds value. Returns whether the box was empty before.
std::vector<T> QcMailbox::takeAll()
Returns all values in the order they came and empties the box.