You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2021/08/06 08:28:03 UTC

[tvm] branch main updated: [FIX] Fix threadpool reset by killing threads before destroying their shared queue (#8658)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 40de9ce  [FIX] Fix threadpool reset by killing threads before destroying their shared queue (#8658)
40de9ce is described below

commit 40de9ce93ca1e3228725715ea9848b22bc086f43
Author: Tristan Konolige <tr...@gmail.com>
AuthorDate: Fri Aug 6 01:27:51 2021 -0700

    [FIX] Fix threadpool reset by killing threads before destroying their shared queue (#8658)
---
 src/runtime/thread_pool.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/runtime/thread_pool.cc b/src/runtime/thread_pool.cc
index c11e9f7..c8d1845 100644
--- a/src/runtime/thread_pool.cc
+++ b/src/runtime/thread_pool.cc
@@ -276,8 +276,9 @@ class ThreadPool {
     for (std::unique_ptr<SpscTaskQueue>& q : queues_) {
       q->SignalForKill();
     }
-    queues_.clear();
+    // Destroy threads before we destory the shared queue, otherwise we segfault on MacOS
     threads_.reset();
+    queues_.clear();
     Init();
   }