try_lock_mutexT_try_lock_mutexTryLockMutexTryLockMutex (Operator)
Name
try_lock_mutexT_try_lock_mutexTryLockMutexTryLockMutex
— Lock a mutex synchronization object.
Signature
Description
try_lock_mutextry_lock_mutexTryLockMutexTryLockMutexTryLockMutex
behaves identically to lock_mutexlock_mutexLockMutexLockMutexLockMutex
, except
that it does not block the calling thread if the mutex is already locked by
another thread but returns immediately. The state of the mutex before trying
to lock it is returned in BusyBusyBusyBusybusy
. 1 indicates that the mutex
was already locked before calling try_lock_mutextry_lock_mutexTryLockMutexTryLockMutexTryLockMutex
, 0 that
the mutex was unlocked (signaled).
Execution Information
- Multithreading type: independent (runs in parallel even with exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
MutexHandleMutexHandleMutexHandleMutexHandlemutexHandle
(input_control) mutex →
HMutex, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Mutex synchronization object.
BusyBusyBusyBusybusy
(output_control) number →
HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Mutex already locked?
Result
If the mutex handle is valid, the operator try_lock_mutextry_lock_mutexTryLockMutexTryLockMutexTryLockMutex
returns 2 (H_MSG_TRUE). If necessary, an exception is raised.
Possible Predecessors
create_mutexcreate_mutexCreateMutexCreateMutexCreateMutex
Possible Successors
unlock_mutexunlock_mutexUnlockMutexUnlockMutexUnlockMutex
See also
lock_mutexlock_mutexLockMutexLockMutexLockMutex
Module
Foundation