mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 01:14:40 +00:00
fix for mac & use atomic store on write side to avoid race
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user