Skip to main content

mutex_take

Function mutex_take 

Source
pub unsafe extern "C" fn mutex_take(
    mutex: mutex_t,
    timeout: u32,
) -> bool
Expand description

Takes and locks a mutex, waiting for up to a certain number of milliseconds before timing out.

See https://pros.cs.purdue.edu/v5/tutorials/topical/multitasking.html#mutexes for details.

\param mutex Mutex to attempt to lock. \param timeout Time to wait before the mutex becomes available. A timeout of 0 can be used to poll the mutex. TIMEOUT_MAX can be used to block indefinitely.

\return True if the mutex was successfully taken, false otherwise. If false is returned, then errno is set with a hint about why the the mutex couldn’t be taken.