Function nstd_sys::mutex::nstd_mutex_lock
source · #[no_mangle]
pub extern "C" fn nstd_mutex_lock<'m, 'a>(
mutex: &'m NSTDMutex<'a>
) -> NSTDOptionalMutexLockResult<'m, 'a>Available on crate feature
mutex only.Expand description
Waits for a mutex lock to become acquired, returning a guard wrapping the protected data.
Attempting to call this function on a thread that already owns the lock will either result in a panic or a deadlock.
Parameters:
const NSTDMutex *mutex- The mutex to lock.
Returns
NSTDOptionalMutexLockResult guard - A handle to the mutex’s protected data on success, or an
uninitialized “none” variant on error.
Panics
This operation may panic if the lock is already held by the current thread.