summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Locatti <rodrigo.locatti@gmail.com>2021-06-22 04:27:44 -0300
committerRodrigo Locatti <rodrigo.locatti@gmail.com>2021-06-22 04:27:44 -0300
commit1ca9a13e507ae5ba7c23b510b2dae0ab26d501fd (patch)
treee46ac457f8c36a815f2035398387f60f11149397
parent0485b8e84bacbf7fd56081822faca46114cbeb85 (diff)
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.
-rw-r--r--src/common/detached_tasks.cpp2
1 files changed, 2 insertions, 0 deletions
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;