diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-02 00:26:17 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-02 00:26:17 +0000 |
| commit | 3c90a059571cb879a468a00c0ca26c9a35090c38 (patch) | |
| tree | 01ac6c50d2c0589bf21b07bccf1d73bf30aba83b /src/threading.cpp | |
| parent | d16ddf7926935e66057239194bbcb699409fafdf (diff) | |
Replace condition+mutex with futex
Diffstat (limited to 'src/threading.cpp')
| -rw-r--r-- | src/threading.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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) { |