pub unsafe extern "C" fn k_mutex_lock(
mutex: *mut k_mutex,
timeout: k_timeout_t,
) -> i32
Expand description
@brief Lock a mutex.
This routine locks @a mutex. If the mutex is locked by another thread, the calling thread waits until the mutex becomes available or until a timeout occurs.
A thread is permitted to lock a mutex it has already locked. The operation completes immediately and the lock count is increased by 1.
Mutexes may not be locked in ISRs.
@param mutex Address of the mutex. @param timeout Waiting period to lock the mutex, or one of the special values K_NO_WAIT and K_FOREVER.
@retval 0 Mutex locked. @retval -EBUSY Returned without waiting. @retval -EAGAIN Waiting period timed out.