Mutex.LockMutex

Syntax

Mutex.LockMutex( threadId, threadDisplayName, homeSyncMgr, timeoutInSeconds, sequenceContextObj, processMsgs, isPartOfGroupLock, waitRes, deadlockElabMsg)

Return Value

AutoReleaser

An object that automatically unlocks the mutex when you release the last reference to the AutoReleaser object.

Purpose

Performs a Lock operation on the mutex.

Parameters

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. This name reports 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 Engine.GetSyncManager 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.

Notice You can pass a NULL reference for this parameter but doing so causes deadlock detection to not function properly. When deadlock occurs, the application might hang.

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 .

isPartOfGroupLock As Boolean

[In] This parameter is used internally to implement the Mutex.LockMutexGroup method. Always pass False for this parameter.

waitRes As WaitResult

[Out] Returns the status of the operation.

deadlockElabMsg As String

[Out] When the waitRes parameter returns the WaitResult_DeadlockDetected enumeration, this parameter returns a description of why the deadlock occurred.

See Also

AutoReleaser

Engine.GetSyncManager

Mutex.LockMutexGroup

Sequence Context

TestStand Engine

Thread.UniqueThreadId

WaitResult