Package org.qbicc.runtime.linux
Class Futex
java.lang.Object
org.qbicc.runtime.linux.Futex
Support for
futex(2) on Linux. See the manpage for more information.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stdint.uint32_tstatic final CNative.c_intstatic final CNative.c_intstatic final CNative.c_intstatic final CNative.c_intstatic final CNative.c_int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanfutex_wait(Stdint.uint32_t_ptr uaddr, Stdint.uint32_t val, Time.const_struct_timespec_ptr timeout) Wait until the value at given address is equal toval.static booleanfutex_wait_absolute(Stdint.uint32_t_ptr uaddr, Stdint.uint32_t val, Time.const_struct_timespec_ptr timeout) Wait until the value at given address is equal toval.static booleanWake all waiters after updating the wait value.static booleanWake a single waiter after updating the wait value.
-
Field Details
-
FUTEX_PRIVATE_FLAG
-
FUTEX_CLOCK_REALTIME
-
FUTEX_WAIT
-
FUTEX_WAIT_BITSET
-
FUTEX_WAKE
-
FUTEX_BITSET_MATCH_ANY
-
-
Constructor Details
-
Futex
public Futex()
-
-
Method Details
-
futex_wait
public static boolean futex_wait(Stdint.uint32_t_ptr uaddr, Stdint.uint32_t val, Time.const_struct_timespec_ptr timeout) Wait until the value at given address is equal toval. Returns when woken (may be spurious). Spurious wakeups may returnfalseand seterrnotoEAGAIN, or may returntrue. If the value at the test memory location already does not equalval, a wakeup will result.- Parameters:
uaddr- the address of the memory to testval- the value to observetimeout- the relative amount of time to wait- Returns:
trueon success, orfalseon error (inerrno)
-
futex_wait_absolute
public static boolean futex_wait_absolute(Stdint.uint32_t_ptr uaddr, Stdint.uint32_t val, Time.const_struct_timespec_ptr timeout) Wait until the value at given address is equal toval. Returns when woken (may be spurious). Spurious wakeups may returnfalseand seterrnotoEAGAIN, or may returntrue. If the value at the test memory location already does not equalval, a wakeup will result.- Parameters:
uaddr- the address of the memory to testval- the value to observetimeout- the absolute time to wake up- Returns:
trueon success, orfalseon error (inerrno)
-
futex_wake_single
Wake a single waiter after updating the wait value.- Parameters:
uaddr- the address of the memory being waited on- Returns:
trueon success, orfalseon error (inerrno)
-
futex_wake_all
Wake all waiters after updating the wait value.- Parameters:
uaddr- the address of the memory being waited on- Returns:
trueon success, orfalseon error (inerrno)
-