Function ctru_sys::syncArbitrateAddressWithTimeout
source · pub unsafe extern "C" fn syncArbitrateAddressWithTimeout(
addr: *mut s32,
type_: ArbitrationType,
value: s32,
timeout_ns: s64
) -> Result
Expand description
Function used to implement user-mode synchronization primitives (with timeout).
§Arguments
addr
- Pointer to a signed 32-bit value whose address will be used to identify waiting threads.type
- Type of action to be performed by the arbiter (must use ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT or ARBITRATION_DECREMENT_AND_WAIT_IF_LESS_THAN_TIMEOUT)value
- Number of threads to signal if using ARBITRATION_SIGNAL, or the value used for comparison.
This will perform an arbitration based on #type. The comparisons are done between #value and the value at the address #addr.
s32 val=0; // Thread will wait for a signal or wake up after 10000000 nanoseconds because val < 1. syncArbitrateAddressWithTimeout(&val,ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT,1,10000000LL);
Note: Usage of this function entails an implicit Data Memory Barrier (dmb).