Skip to content

Commit 8399a00

Browse files
committed
MMCore: speed up logging shutdown
Avoid the up to 10 ms sleep before logging is shut down. Didn't matter much for regular use, but adds up in MMCore unit tests. (Assisted by Claude Code; any errors are mine.)
1 parent 22e85fd commit 8399a00

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Logging/GenericPacketQueue.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,10 @@ class GenericPacketQueue
130130
{
131131
if (timedWaitMode)
132132
{
133-
// TODO Make interval configurable
134-
std::this_thread::sleep_for(10ms);
135-
136133
{
137-
std::lock_guard<std::mutex> lock(mutex_);
134+
std::unique_lock<std::mutex> lock(mutex_);
135+
condVar_.wait_for(lock, 10ms,
136+
[&] { return shutdownRequested_; });
138137
if (shutdownRequested_)
139138
{
140139
shutdownRequested_ = false; // Allow for restarting

0 commit comments

Comments
 (0)