diff options
| author | gingerBill <bill@gingerbill.org> | 2021-10-26 11:46:31 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-10-26 11:46:31 +0100 |
| commit | d165de0d4db0da4169487dec182492294fdf0936 (patch) | |
| tree | 853326427477425c2c227202ed00951d41270ef6 /core/thread | |
| parent | 5fb70c4c94e4368d0dd1d0da893e66ed76a1aa0e (diff) | |
Move thread initialization variables in thread_unix.odin
Diffstat (limited to 'core/thread')
| -rw-r--r-- | core/thread/thread_unix.odin | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/thread/thread_unix.odin b/core/thread/thread_unix.odin index f78d8f66f..cee278c7a 100644 --- a/core/thread/thread_unix.odin +++ b/core/thread/thread_unix.odin @@ -76,6 +76,9 @@ _create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^ return nil } thread.creation_allocator = context.allocator + + sync.mutex_init(&thread.start_mutex) + sync.condition_init(&thread.start_gate, &thread.start_mutex) // Set thread priority. policy: i32 @@ -96,12 +99,13 @@ _create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^ if unix.pthread_create(&thread.unix_thread, &attrs, __linux_thread_entry_proc, thread) != 0 { free(thread, thread.creation_allocator) + + sync.condition_destroy(&thread.start_gate) + sync.mutex_destroy(&thread.start_mutex) return nil } thread.procedure = procedure - sync.mutex_init(&thread.start_mutex) - sync.condition_init(&thread.start_gate, &thread.start_mutex) return thread } |