mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-14 15:23:15 +00:00
Rename futex_wake and futex_wake_all to futex_signal and futex_broadcast
This commit is contained in:
@@ -46,7 +46,7 @@ _futex_wait_with_timeout :: proc(f: ^Futex, expected: u32, duration: time.Durati
|
||||
|
||||
}
|
||||
|
||||
_futex_wake_single :: proc(f: ^Futex) {
|
||||
_futex_signal :: proc(f: ^Futex) {
|
||||
loop: for {
|
||||
s := __ulock_wake(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO, f, 0)
|
||||
if s >= 0 {
|
||||
@@ -63,7 +63,7 @@ _futex_wake_single :: proc(f: ^Futex) {
|
||||
}
|
||||
}
|
||||
|
||||
_futex_wake_all :: proc(f: ^Futex) {
|
||||
_futex_broadcast :: proc(f: ^Futex) {
|
||||
loop: for {
|
||||
s := __ulock_wake(UL_COMPARE_AND_WAIT | ULF_NO_ERRNO | ULF_WAKE_ALL, f, 0)
|
||||
if s >= 0 {
|
||||
|
||||
@@ -84,7 +84,7 @@ _futex_wait_with_timeout :: proc(f: ^Futex, expected: u32, duration: time.Durati
|
||||
}
|
||||
|
||||
|
||||
_futex_wake_single :: proc(f: ^Futex) {
|
||||
_futex_signal :: proc(f: ^Futex) {
|
||||
err := internal_futex(f, FUTEX_WAKE_PRIVATE | FUTEX_WAKE, 1, nil)
|
||||
switch err {
|
||||
case ESUCCESS, EINVAL, EFAULT:
|
||||
@@ -93,7 +93,7 @@ _futex_wake_single :: proc(f: ^Futex) {
|
||||
panic("futex_wake_single failure")
|
||||
}
|
||||
}
|
||||
_futex_wake_all :: proc(f: ^Futex) {
|
||||
_futex_broadcast :: proc(f: ^Futex) {
|
||||
err := internal_futex(f, FUTEX_WAKE_PRIVATE | FUTEX_WAKE, u32(max(i32)), nil)
|
||||
switch err {
|
||||
case ESUCCESS, EINVAL, EFAULT:
|
||||
|
||||
@@ -29,10 +29,10 @@ _futex_wait_with_timeout :: proc(f: ^Futex, expect: u32, duration: time.Duration
|
||||
return bool(WaitOnAddress(f, &expect, size_of(expect), timeout))
|
||||
}
|
||||
|
||||
_futex_wake_single :: proc(f: ^Futex) {
|
||||
_futex_signal :: proc(f: ^Futex) {
|
||||
WakeByAddressSingle(f)
|
||||
}
|
||||
|
||||
_futex_wake_all :: proc(f: ^Futex) {
|
||||
_futex_broadcast :: proc(f: ^Futex) {
|
||||
WakeByAddressAll(f)
|
||||
}
|
||||
@@ -219,9 +219,9 @@ sema_wait_with_timeout :: proc(s: ^Sema, duration: time.Duration) -> bool {
|
||||
sema_post :: proc(s: ^Sema, count := 1) {
|
||||
atomic_add(&s.count, Futex(count))
|
||||
if count == 1 {
|
||||
futex_wake_single(&s.count)
|
||||
futex_signal(&s.count)
|
||||
} else {
|
||||
futex_wake_all(&s.count)
|
||||
futex_broadcast(&s.count)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,10 +251,10 @@ futex_wait_with_timeout :: proc(f: ^Futex, expected: u32, duration: time.Duratio
|
||||
return _futex_wait_with_timeout(f, expected, duration)
|
||||
}
|
||||
|
||||
futex_wake_single :: proc(f: ^Futex) {
|
||||
_futex_wake_single(f)
|
||||
futex_signal :: proc(f: ^Futex) {
|
||||
_futex_signal(f)
|
||||
}
|
||||
|
||||
futex_wake_all :: proc(f: ^Futex) {
|
||||
_futex_wake_all(f)
|
||||
futex_broadcast :: proc(f: ^Futex) {
|
||||
_futex_broadcast(f)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ atomic_mutex_lock :: proc(m: ^Atomic_Mutex) {
|
||||
atomic_mutex_unlock :: proc(m: ^Atomic_Mutex) {
|
||||
@(cold)
|
||||
unlock_slow :: proc(m: ^Atomic_Mutex) {
|
||||
futex_wake_single((^Futex)(&m.state))
|
||||
futex_signal((^Futex)(&m.state))
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ queue_item_wait_with_timeout :: proc(item: ^Queue_Item, duration: time.Duration)
|
||||
@(private="file")
|
||||
queue_item_signal :: proc(item: ^Queue_Item) {
|
||||
atomic_store_release(&item.futex, 1)
|
||||
futex_wake_single(&item.futex)
|
||||
futex_signal(&item.futex)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ when #config(ODIN_SYNC_RECURSIVE_MUTEX_USE_FUTEX, true) {
|
||||
}
|
||||
atomic_exchange_release(&m.impl.owner, 0)
|
||||
|
||||
futex_wake_single(&m.impl.owner)
|
||||
futex_signal(&m.impl.owner)
|
||||
// outside the lock
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user