Mutex.LockMutexGroup
- Aktualisiert2025-07-21
- 3 Minute(n) Lesezeit
Mutex.LockMutexGroup
Syntax
Mutex.LockMutexGroup( mutexArray, threadId, threadDisplayName, homeSyncMgr, timeoutInSeconds, sequenceContextObj, processMsgs, waitRes, deadlockElabMsg)
Return Value
An array of objects that automatically unlocks the mutexes when you release the last reference to the AutoReleaser objects.
Purpose
Performs a Lock operation on a group of mutexes. This operation attempts to lock all the locks you specify. When the operation cannot lock all the locks, it unlocks the successful locks and tries again after a random delay. This behavior continues until the operation succeeds in locking all the locks or the timeout you specify occurs. When you use this method to lock all the locks a thread requires, you avoid the possibility of deadlock. However, you lose the guarantee of first in, first out (FIFO) ordering of which thread can lock a particular lock first.
Parameters
mutexArray As Object Array
[In] Specifies an array of Mutex objects to lock.
threadId As String
[In] Specifies a globally unique thread ID (GUID) for the thread that performs the operation. When you call this method from a TestStand execution, specify the value of the Thread.UniqueThreadId property for this parameter. Because the TestStand Synchronization Manager permits sharing of mutexes among computers, you must use an ID more unique than just the current operating system thread ID of the current thread on the current computer. When you plan to use mutexes across computers, use a GUID or some other way of creating a thread ID that is unique across all computers. The Thread.UniqueThreadId property is a GUID.
threadDisplayName As String
[In] Specifies a display name to identify the current thread. Use this name to report a deadlock condition, when one occurs, involving this thread.
homeSyncMgr As SyncManager
[In] Specifies the local version of the TestStand Synchronization Manager. When you use the TestStand Engine , National Instruments recommends that you call the method on a local version of the TestStand Engine to obtain the value to pass for this parameter. Use this parameter for deadlock detection purposes.
timeoutInSeconds As Double
[In] Specifies a timeout in seconds. Pass a negative number to specify that you do not want a timeout.
sequenceContextObj As Object
[In] Specifies a sequence context when you call this method from within a step of an execution. You must use the sequence context of the sequence in which you are calling this method. Pass a NULL reference when you do not call this method from an execution. This method uses the sequence context to improve the behavior of the execution when it is blocked while waiting on this method.
processMsgs As Boolean
[In] Pass True to process Microsoft Windows messages while waiting. When you call this method from an execution, pass True for this parameter. Otherwise, pass False .
waitRes As WaitResult
[Out] Returns the status of the operation.
deadlockElabMsg As String
[Out] When the waitRes parameter returns WaitResult_DeadlockDetected , this parameter returns a description of why the deadlock occurred.