Skip to content

try_lock_mutexTryLockMutexTryLockMutextry_lock_mutexT_try_lock_mutex🔗

Short description🔗

try_lock_mutexTryLockMutexTryLockMutextry_lock_mutexT_try_lock_mutex — Lock a mutex synchronization object.

Signature🔗

try_lock_mutex( mutex MutexHandle, out number Busy )void TryLockMutex( const HTuple& MutexHandle, HTuple* Busy )static void HOperatorSet.TryLockMutex( HTuple mutexHandle, out HTuple busy )def try_lock_mutex( mutex_handle: HHandle ) -> int

Herror T_try_lock_mutex( const Htuple MutexHandle, Htuple* Busy )

Hlong HMutex::TryLockMutex( ) const

int HMutex.TryLockMutex( )

Description🔗

try_lock_mutexTryLockMutex behaves identically to lock_mutexLockMutex, 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 Busybusybusy. 11 indicates that the mutex was already locked before calling try_lock_mutexTryLockMutex, 00 that the mutex was unlocked (signaled).

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

MutexHandlemutexHandlemutex_handle (input_control) mutex → (handle)HTuple (HHandle)HMutex, HTuple (IntPtr)HHandleHtuple (handle)

Mutex synchronization object.

Busybusybusy (output_control) number → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Mutex already locked?

Result🔗

If the mutex handle is valid, the operator try_lock_mutexTryLockMutex returns 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

create_mutexCreateMutex

Possible successors

unlock_mutexUnlockMutex

See also

lock_mutexLockMutex

Module🔗

Foundation