Skip to content
Snippets Groups Projects
Commit 44163fe0 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

vtkDataEncoder: wake up worker threads at least once a second

There's some case where a worker thread wakes up and doesn't see that it
needs to bail properly. Ensure that each thread wakes up at least once a
second to force a re-check.

Fixes: #18612
parent 38aa46e8
No related branches found
No related tags found
No related merge requests found
......@@ -88,9 +88,18 @@ class vtkWorkQueue
vtkWork work;
{
std::unique_lock<std::mutex> lock(self->QueueMutex);
self->QueueCondition.wait(
lock, [self]() { return !self->Queue.empty() || self->Terminate; });
if (self->Terminate)
bool break_loop = false;
do
{
self->QueueCondition.wait_for(lock, std::chrono::seconds(1),
[self]() { return !self->Queue.empty() || self->Terminate; });
if (self->Terminate)
{
break_loop = true;
break;
}
} while (self->Queue.empty());
if (break_loop)
{
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment