From 446094f608355bc351e8b0aad0223ba8081519dc Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Mon, 1 Jan 2024 18:54:31 -0500 Subject: add inner function for detatching all threads --- src/thread_pool.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp index b5be8fc..41aaf7d 100644 --- a/src/thread_pool.cpp +++ b/src/thread_pool.cpp @@ -58,6 +58,15 @@ void inline PkeThreads_JoinAll_Inner(ThreadPool &tp) { } } +void inline PkeThreads_DetatchAll_Inner(ThreadPool &tp) { + long count = tp.threads->Count(); + for (long i = 0; i < count; ++i) { + auto &t = (*tp.threads)[i]; + t.detach(); + } + tp.condition.notify_all(); +} + void inline PkeThreads_Reset_Inner(ThreadPool &tp) { tp.mutex.lock(); tp.maxJobQueueCount = 0; -- cgit v1.2.3