NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Activating locks using TestStand API

Hello,

I have a question... how do I lock and unlock a lock, created in TestStand, in Visual Basic (by using the teststand API)?

Greetz Jan Toebes
0 Kudos
Message 1 of 3
(2,950 Views)
Hello,

To understand you correctly you are trying to perform a lock or unlock through Visual Basic. For this you have to use the synchronization server, which has a different API for itself. You can get more information about this under "TestStand Supplemental Reference Help" section in the TestStand Help.

For simplicity sake, lets assume that you have a lock step created in teststand and you want to perform an unlock using Visual Basic.

To perform this task, you need the SyncManager. This is the main class for all Synchronization objects. This class helps manage the creation and sharing of the different Synchronization objects between threads. You must create all Synchronization objects using this class.

To get the appropriate instance of the TestStand Synchronization Manager call the Engine.GetSyncManager TestStand API method. The Engine.GetSyncManager method returns the TestStand Synchronization Manager for the appropriate process based on the name of the Synchronization object. So the call would be

SyncManager = Engine.GetSyncManager(* Name_of_the_lock_Step)

where the Name_of_the_Step is the actual name of the lock step that we created in TestStand. The "*" before that indicates that this lock step was created in a separate thread and is being shared.

Now Mutex is the class that implements the Lock synchronization and is used to implement the Lock step type in TestStand. So using the SynCManager will get an instance of this Mutex class by using:

Mutex = SyncManager.GetMutex(* Mame_of_the_lock_step)

Now using Mutex you can perform an unlock by using:

Mutex.EarlyUnlockMutex ( threadId)

Please refer to the help for more information regarding these functions. I hope this helps.

SijinK
National Instruments
0 Kudos
Message 2 of 3
(2,914 Views)
One thing to keep in mind, is that the name of your lock must be created with the prefix "*" to share between processes.

Allen P.
NI
0 Kudos
Message 3 of 3
(2,906 Views)