Skip to main content

nros_platform_condvar_wait_until

Function nros_platform_condvar_wait_until 

Source
pub unsafe extern "C" fn nros_platform_condvar_wait_until(
    cv: *mut c_void,
    m: *mut c_void,
    abstime: u64,
) -> i8
Expand description

Atomically release m and block on cv until signalled or until the absolute monotonic deadline abstime, in MILLISECONDS on the nros_platform_clock_ns() epoch — i.e. clock_ns() / 1000000. The mutex is re-acquired before this returns. Returns 0 when signalled, 1 on timeout and -1 on error, the same codes as nros_platform_wake_wait_ms (issue 1906: FreeRTOS returned -1 on timeout, so a caller could not tell a timeout from a failure). A port rounds the remaining time UP to its tick, so the wait never times out before its deadline.

This is the ONLY condvar wait in the ABI. The unbounded nros_platform_condvar_wait was removed (issue 1196, phase-436 D2): it sat here with a neutral name, every port implemented it with its forever spelling, and “no unbounded wait” is only a property of the system if it is a property of the API. A caller whose own contract is unbounded — the zenoh-pico shim’s _z_condvar_wait was the last one — loops over bounded waits and re-tests its predicate, which a condvar caller must do anyway because of spurious wakeups. scripts/check-no-unbounded-condvar-wait.sh keeps the symbol from coming back.

The unit is spelt out because this said “clock_ms units” after RFC-0073 / phase-352 W6 retired nros_platform_clock_ms; it never changed — every port names the parameter abstime_ms.