mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-19 16:11:30 +00:00
Use Acquire semantics for the futex_wait load shortcut
This commit is contained in:
@@ -195,7 +195,7 @@ sema_wait_with_timeout :: proc(s: ^Sema, duration: time.Duration) -> bool {
|
|||||||
Futex :: distinct u32
|
Futex :: distinct u32
|
||||||
|
|
||||||
futex_wait :: proc(f: ^Futex, expected: u32) {
|
futex_wait :: proc(f: ^Futex, expected: u32) {
|
||||||
if u32(atomic_load(f)) != expected {
|
if u32(atomic_load_explicit(f, .Acquire)) != expected {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ futex_wait :: proc(f: ^Futex, expected: u32) {
|
|||||||
|
|
||||||
// returns true if the wait happened within the duration, false if it exceeded the time duration
|
// returns true if the wait happened within the duration, false if it exceeded the time duration
|
||||||
futex_wait_with_timeout :: proc(f: ^Futex, expected: u32, duration: time.Duration) -> bool {
|
futex_wait_with_timeout :: proc(f: ^Futex, expected: u32, duration: time.Duration) -> bool {
|
||||||
if u32(atomic_load(f)) != expected {
|
if u32(atomic_load_explicit(f, .Acquire)) != expected {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if duration <= 0 {
|
if duration <= 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user