From cce568a7f56861d6249d7445f51d0ed27c560a5c Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 11 Jan 2024 11:13:15 -0500 Subject: checkpoint - mostly working condition after changes --- src/thread_pool.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/thread_pool.cpp') 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); tp->bkt = CAFE_BABE(MemBucket); } + +void PkeThreads_Teardown() { + Buckets_Destroy(ThreadPool_BucketContainer); +} -- cgit v1.2.3