Просмотр исходного кода

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.
Rodrigo Locatti 5 лет назад
Родитель
Сommit
1ca9a13e50
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      src/common/detached_tasks.cpp

+ 2 - 0
src/common/detached_tasks.cpp

@@ -21,6 +21,8 @@ void DetachedTasks::WaitForAllTasks() {
 }
 }
 
 
 DetachedTasks::~DetachedTasks() {
 DetachedTasks::~DetachedTasks() {
+    WaitForAllTasks();
+
     std::unique_lock lock{mutex};
     std::unique_lock lock{mutex};
     ASSERT(count == 0);
     ASSERT(count == 0);
     instance = nullptr;
     instance = nullptr;