CHECKs that all queues are finished on destruction. (#106)
parent
15f9244577
commit
224b068fe9
|
@ -50,15 +50,19 @@ inline std::ostream& operator<<(std::ostream& out, const QueueKey& key) {
|
|||
}
|
||||
|
||||
// Maintains multiple queues of sorted sensor data and dispatches it in merge
|
||||
// sorted order. This class is thread-compatible.
|
||||
// sorted order. It will wait to see at least one value for each unfinished queue before
|
||||
// dispatching the next time ordered value across all queues. This class is thread-compatible.
|
||||
class OrderedMultiQueue {
|
||||
public:
|
||||
using Callback = std::function<void(std::unique_ptr<Data>)>;
|
||||
|
||||
// Will wait to see at least one value for each unfinished queue before
|
||||
// dispatching the next smallest value across all queues.
|
||||
OrderedMultiQueue() {}
|
||||
~OrderedMultiQueue() {}
|
||||
|
||||
~OrderedMultiQueue() {
|
||||
for (auto& entry : queues_) {
|
||||
CHECK(entry.second.finished);
|
||||
}
|
||||
}
|
||||
|
||||
void AddQueue(const QueueKey& queue_key, Callback callback) {
|
||||
CHECK(FindOrNull(queue_key) == nullptr);
|
||||
|
|
Loading…
Reference in New Issue