diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2024-01-01 18:54:31 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2024-01-01 18:54:31 -0500 |
| commit | 446094f608355bc351e8b0aad0223ba8081519dc (patch) | |
| tree | 3ea84b10f9e3b41cd761fc12b5a56fd864c21fd3 /src | |
| parent | 5e255ce57f75acda03a0ff5103767f9cb5334396 (diff) | |
add inner function for detatching all threads
Diffstat (limited to 'src')
| -rw-r--r-- | src/thread_pool.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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; |
