hermit::syscalls

Function sys_sem_trywait

Source
#[no_mangle]
pub unsafe extern "C" fn sys_sem_trywait(sem: *mut sem_t) -> i32
Expand description

Try to acquire a lock on a semaphore.

This function does not block if the acquire fails. If the acquire fails (i.e. the semaphore’s count is already 0), the function returns immediately.

Returns 0 on lock acquire, -EINVAL if sem is null, or -ECANCELED if the decrement fails.