From 1ca9a13e507ae5ba7c23b510b2dae0ab26d501fd Mon Sep 17 00:00:00 2001 From: Rodrigo Locatti Date: Tue, 22 Jun 2021 04:27:44 -0300 Subject: common/detached_tasks: Wait for tasks before shutting down If this is not waited on, the synchronization primitives are destroyed whe main exits and the detached task ends up signalling garbage and not properly finishing. --- src/common/detached_tasks.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/common/detached_tasks.cpp b/src/common/detached_tasks.cpp index f2b4939df..c1362631e 100644 --- a/src/common/detached_tasks.cpp +++ b/src/common/detached_tasks.cpp @@ -21,6 +21,8 @@ void DetachedTasks::WaitForAllTasks() { } DetachedTasks::~DetachedTasks() { + WaitForAllTasks(); + std::unique_lock lock{mutex}; ASSERT(count == 0); instance = nullptr; -- cgit v1.2.3