From 3c90a059571cb879a468a00c0ca26c9a35090c38 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 2 Jan 2023 00:26:17 +0000 Subject: Replace condition+mutex with futex --- src/threading.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/threading.cpp') diff --git a/src/threading.cpp b/src/threading.cpp index fb71a2c29..e3f26a8a0 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -393,7 +393,7 @@ gb_internal void thread_init(ThreadPool *pool, Thread *t, isize idx) { #endif t->capacity = 1 << 14; // must be a power of 2 - t->queue = (WorkerTask *)calloc(sizeof(WorkerTask), t->capacity); + t->queue = gb_alloc_array(heap_allocator(), WorkerTask, t->capacity); t->head_and_tail = 0; t->pool = pool; t->idx = idx; @@ -429,6 +429,8 @@ gb_internal void thread_join_and_destroy(Thread *t) { pthread_join(t->posix_handle, NULL); t->posix_handle = 0; #endif + + gb_free(heap_allocator(), t->queue); } gb_internal void thread_set_name(Thread *t, char const *name) { -- cgit v1.2.3