From df84458217be7e909fd3a6b186a22b025afc575b Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Wed, 13 Nov 2024 07:54:22 -0300 Subject: [PATCH] detach threads later --- inst/include/utils.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inst/include/utils.h b/inst/include/utils.h index bfb856eed1..22bcc2582e 100644 --- a/inst/include/utils.h +++ b/inst/include/utils.h @@ -111,7 +111,10 @@ class ThreadPool { ~ThreadPool() { event_loop.stop(); for(auto& thread : threads) { - thread.join(); + // Ideally we would join those threads, but this deadlocks on Windows. + // Detaching seems fine as after `stop` we're making sure that all tasks + // are done. + thread.detach(); } } };