summaryrefslogtreecommitdiff
path: root/src/thread_pool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread_pool.cpp')
-rw-r--r--src/thread_pool.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp
index 4a67054..0fc9880 100644
--- a/src/thread_pool.cpp
+++ b/src/thread_pool.cpp
@@ -124,10 +124,11 @@ void inline PkeThreads_Shutdown_Inner(ThreadPool &tp) {
tp.mutex.unlock();
}
+void PkeThreads_Init() {
+ Buckets_Init(ThreadPool_BucketContainer, MAX_THREADS_PER_BUCKET);
+}
+
ThreadPoolHandle PkeThreads_Init(uint8_t threadCount, uint8_t maxQueueCount, MemBucket *bkt) {
- if (ThreadPool_BucketContainer.pkeHandle.hash == 0) {
- Buckets_Init(ThreadPool_BucketContainer, MAX_THREADS_PER_BUCKET);
- }
assert(threadCount > 0);
ThreadPoolHandle newHandle{Buckets_NewHandle(ThreadPool_BucketContainer)};
@@ -210,3 +211,7 @@ void PkeThreads_Teardown(ThreadPoolHandle handle) {
tp->threads = CAFE_BABE(DynArray<std::thread>);
tp->bkt = CAFE_BABE(MemBucket);
}
+
+void PkeThreads_Teardown() {
+ Buckets_Destroy(ThreadPool_BucketContainer);
+}