diff options
| author | gingerBill <bill@gingerbill.org> | 2019-09-01 23:13:29 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-09-01 23:13:29 +0100 |
| commit | 723f351a6d36193cb36c74c40b40befa3c4302f1 (patch) | |
| tree | 1db5c4b430c6a815c7babcccae26d9163c0f4f30 /src/thread_pool.cpp | |
| parent | c93872cc1371d60863e2dae6c08f556f32dd5a8a (diff) | |
Remove custom allocator for thread pool
Diffstat (limited to 'src/thread_pool.cpp')
| -rw-r--r-- | src/thread_pool.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp index 67e698e5d..32fe3b82f 100644 --- a/src/thread_pool.cpp +++ b/src/thread_pool.cpp @@ -19,23 +19,10 @@ struct ThreadPool { Array<WorkerTask> tasks; Array<gbThread> threads; - gbAllocator original_allocator; - char worker_prefix[10]; i32 worker_prefix_len; }; - -GB_ALLOCATOR_PROC(thread_pool_allocator_proc) { - ThreadPool *pool = cast(ThreadPool *)allocator_data; - return pool->original_allocator.proc(pool->original_allocator.data, type, size, 256, old_memory, old_size, flags); -} - -gbAllocator thread_pool_allocator(ThreadPool *pool) { - gbAllocator a = {thread_pool_allocator_proc, pool}; - return a; -} - void thread_pool_init(ThreadPool *pool, gbAllocator const &a, isize thread_count, char const *worker_prefix = nullptr); void thread_pool_destroy(ThreadPool *pool); void thread_pool_start(ThreadPool *pool); @@ -46,10 +33,8 @@ void thread_pool_kick_and_wait(ThreadPool *pool); GB_THREAD_PROC(worker_thread_internal); void thread_pool_init(ThreadPool *pool, gbAllocator const &a, isize thread_count, char const *worker_prefix) { - pool->original_allocator = a; - gbAllocator tpa = thread_pool_allocator(pool); - pool->tasks = array_make<WorkerTask>(tpa, 0, 1024); - pool->threads = array_make<gbThread>(tpa, thread_count); + pool->tasks = array_make<WorkerTask>(a, 0, 1024); + pool->threads = array_make<gbThread>(a, thread_count); gb_mutex_init(&pool->task_mutex); gb_mutex_init(&pool->mutex); gb_semaphore_init(&pool->semaphore); |