try_lock_mutexT_try_lock_mutexTryLockMutexTryLockMutextry_lock_mutex (算子名称)
名称
try_lock_mutexT_try_lock_mutexTryLockMutexTryLockMutextry_lock_mutex — Lock a mutex synchronization object.
参数签名
描述
try_lock_mutextry_lock_mutexTryLockMutexTryLockMutexTryLockMutextry_lock_mutex behaves identically to lock_mutexlock_mutexLockMutexLockMutexLockMutexlock_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 BusyBusyBusyBusybusybusy. 1 indicates that the mutex
was already locked before calling try_lock_mutextry_lock_mutexTryLockMutexTryLockMutexTryLockMutextry_lock_mutex, 0 that
the mutex was unlocked (signaled).
运行信息
- Multithreading type: independent (runs in parallel even with exclusive operators).
- 多线程作用域:全局(可以从任何线程调用)。
- 未经并行化处理。
参数表
MutexHandleMutexHandleMutexHandleMutexHandlemutexHandlemutex_handle (input_control) mutex → HMutex, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Mutex synchronization object.
BusyBusyBusyBusybusybusy (output_control) number → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Mutex already locked?
结果
If the mutex handle is valid, 该算子 try_lock_mutextry_lock_mutexTryLockMutexTryLockMutexTryLockMutextry_lock_mutex
returns 2 (
H_MSG_TRUE)
. 如有必要,将引发异常。
可能的前置算子
create_mutexcreate_mutexCreateMutexCreateMutexCreateMutexcreate_mutex
可能的后置算子
unlock_mutexunlock_mutexUnlockMutexUnlockMutexUnlockMutexunlock_mutex
参考其它
lock_mutexlock_mutexLockMutexLockMutexLockMutexlock_mutex
模块
Foundation