-
Notifications
You must be signed in to change notification settings - Fork 164
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
bmqc::MultiQueueThreadPool::stop iterates over all processing queues and enqueues a monitor event to request stop, then wait each queue to stop serially.
It might be more efficient to split this loop in two loops.
In the first loop, send a monitor event to the queue and disable push.
In the second loop, wait for all queues to finish using the shared TimedSemaphore.
Implementing this causes some tests to fail. We might have hidden assumptions how the stop is done, and it's worth investigating.
The code:
blazingmq/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.h
Lines 1161 to 1182 in 47a89d5
| for (size_t i = 0; i < d_queues.size(); ++i) { | |
| QueueInfo& info = d_queues[i]; | |
| QueueItem item = {false // isMonitorEvent | |
| , | |
| 0}; // pointer to event | |
| info.d_queue_p->pushBack(item); | |
| info.d_queue_p->disablePushBack(); | |
| // TODO: Change 'd_processedZero' to semaphore instead to avoid busy | |
| // waiting? | |
| while (!info.d_processedZero) { | |
| bslmt::ThreadUtil::yield(); | |
| } | |
| while (!info.d_queue_p->tryPopFront(&item)) { | |
| d_pool.releaseObject(item.d_event_p); | |
| } | |
| d_allocator_p->deleteObject(info.d_queue_p); | |
| info.reset(); | |
| } |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request