Operator Reference

try_lock_mutexT_try_lock_mutexTryLockMutexTryLockMutextry_lock_mutex (Operator)

try_lock_mutexT_try_lock_mutexTryLockMutexTryLockMutextry_lock_mutex — Lock a mutex synchronization object.

Signature

try_lock_mutex( : : MutexHandle : Busy)

Herror T_try_lock_mutex(const Htuple MutexHandle, Htuple* Busy)

void TryLockMutex(const HTuple& MutexHandle, HTuple* Busy)

Hlong HMutex::TryLockMutex() const

static void HOperatorSet.TryLockMutex(HTuple mutexHandle, out HTuple busy)

int HMutex.TryLockMutex()

def try_lock_mutex(mutex_handle: HHandle) -> int

Description

try_lock_mutextry_lock_mutexTryLockMutexTryLockMutextry_lock_mutex behaves identically to lock_mutexlock_mutexLockMutexLockMutexlock_mutex, 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_mutexTryLockMutexTryLockMutextry_lock_mutex, 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

MutexHandleMutexHandleMutexHandlemutexHandlemutex_handle (input_control)  mutex HMutex, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Mutex synchronization object.

BusyBusyBusybusybusy (output_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Mutex already locked?

Result

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

Possible Predecessors

create_mutexcreate_mutexCreateMutexCreateMutexcreate_mutex

Possible Successors

unlock_mutexunlock_mutexUnlockMutexUnlockMutexunlock_mutex

See also

lock_mutexlock_mutexLockMutexLockMutexlock_mutex

Module

Foundation