From feebf26fc3776c8e9a24a0ee5e799d1548497d12 Mon Sep 17 00:00:00 2001 From: Tristan Konolige Date: Wed, 4 Aug 2021 12:21:13 -0700 Subject: [PATCH] [FIX] Fix threadpool reset by killing threads before destroying their shared queue --- 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 c11e9f7ac084..c8d1845266e8 100644 --- a/src/runtime/thread_pool.cc +++ b/src/runtime/thread_pool.cc @@ -276,8 +276,9 @@ class ThreadPool { for (std::unique_ptr& q : queues_) { q->SignalForKill(); } - queues_.clear(); + // Destroy threads before we destory the shared queue, otherwise we segfault on MacOS threads_.reset(); + queues_.clear(); Init(); }