lock_mutexT_lock_mutexLockMutexLockMutexlock_mutex (算子)

名称

lock_mutexT_lock_mutexLockMutexLockMutexlock_mutex — 锁定互斥同步对象。

签名

lock_mutex( : : MutexHandle : )

Herror T_lock_mutex(const Htuple MutexHandle)

void LockMutex(const HTuple& MutexHandle)

void HMutex::LockMutex() const

static void HOperatorSet.LockMutex(HTuple mutexHandle)

void HMutex.LockMutex()

def lock_mutex(mutex_handle: HHandle) -> None

描述

lock_mutexlock_mutexLockMutexLockMutexLockMutexlock_mutex locks the mutex given by MutexHandleMutexHandleMutexHandleMutexHandlemutexHandlemutex_handle. If the mutex is currently unlocked, it becomes locked and owned by the calling thread, and lock_mutexlock_mutexLockMutexLockMutexLockMutexlock_mutex returns immediately. If the mutex is already locked by another thread, the calling thread waits until the mutex is unlocked. The kind of wait is defined by the mutex' attributes set during creation in create_mutexcreate_mutexCreateMutexCreateMutexCreateMutexcreate_mutex

执行信息

参数

MutexHandleMutexHandleMutexHandleMutexHandlemutexHandlemutex_handle (输入控制)  mutex HMutex, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Mutex synchronization object.

结果

If the mutex handle is valid, the operator lock_mutexlock_mutexLockMutexLockMutexLockMutexlock_mutex 返回 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

可能的前趋

create_mutexcreate_mutexCreateMutexCreateMutexCreateMutexcreate_mutex

可能的后继

unlock_mutexunlock_mutexUnlockMutexUnlockMutexUnlockMutexunlock_mutex

另见

try_lock_mutextry_lock_mutexTryLockMutexTryLockMutexTryLockMutextry_lock_mutex

模块

基础