diff options
| author | Dale Weiler <weilercdale@gmail.com> | 2022-03-11 08:35:23 -0500 |
|---|---|---|
| committer | Dale Weiler <weilercdale@gmail.com> | 2022-03-11 08:35:23 -0500 |
| commit | 52df80dccd6a340a582b2b2a8ede682274fec0cd (patch) | |
| tree | 2e1f4defd0b28bf18dc3eafa54667a418e8209f6 /core | |
| parent | 7f845bb1655e671c19ae08d6be6b4c4e359a8152 (diff) | |
fix for mac & use atomic store on write side to avoid race
Diffstat (limited to 'core')
| -rw-r--r-- | core/thread/thread_unix.odin | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/thread/thread_unix.odin b/core/thread/thread_unix.odin index 8e1ab2b2c..e40091cca 100644 --- a/core/thread/thread_unix.odin +++ b/core/thread/thread_unix.odin @@ -44,7 +44,7 @@ _create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^ t.procedure(t) - t.flags += { .Done } + intrinsics.atomic_store(&t.flags, t.flags + { .Done }); sync.unlock(&t.mutex) @@ -105,7 +105,7 @@ _start :: proc(t: ^Thread) { } _is_done :: proc(t: ^Thread) -> bool { - return intrinsics.atomic_and(&t.flags, { .Done }) != nil + return .Done in intrinsics.atomic_load(&t.flags); } _join :: proc(t: ^Thread) { |