I have two threads running in parallel.
The first thread which is the MainSequence and the second one which is the new thread.
The first thread is used to send all the commands to the product.
The second one is used to ask the product if there is a problem or not on its Autotest every 5 secondes.
The fact is that if I send a command to the product at the same time as there is an Autotest, TestStand stop by telling that it is not possible to ask something to the product.
Can you please help finding any solution to pause the second thread when I need to send any command to the product ?
Solved! Go to Solution.
On any of the steps in either sequence that have communication to the product, you could use the Properties->Synchronization->Lock feature.
There's an example based on the batch model, but the multithread aspect I think is applicable to you too.
Examples\Built-In Step Types\Synchronization Step Types\Synchronization Step Types - Lock.seq
I think I would add Lock/Unlock steps before and after your Autotest in the new thread. In your MainSequence, I would use the Lock feature in the communication steps to look for the Lock name (say it's "comm").
Thanks for you reply.
I don't think it's exactly what I need.
In fact, I would like to completly stop the Autotest thread execution and continue the MainSequence.
I made some trials with the "Lock" functionnality, but I cannot manage to do so.
It sounds like when MainSequence is communicating, you don't want your AutoTest thread communicating. After MainSequence is finished communicating, do you want your AutoTest thread to communicate again?
Locking will enable one thread to wait for another if a resource (in this case, the DUT) is being used by another thread.
If you want your AutoTest thread to "completely stop" (I interpret this to mean stop running for the rest of the time), then you could (one of many possible ideas) set a FileGlobals flag in MainSequence that the AutoTest thread checks for and exits when the flag is true.
Thank you for your help.
I already use a flag to definitely stop my Autotest running.
But in fact, what I want is just to pause the Autotest during some signal recording I need to do on the product.
So that the thread of my Autotest will wait the recording to be completed before continuing.
According to what you explained, it should be possible with the Lock Synchronisation, but I cannot manage with the TestStand exemple on my computer.
Could you please help me again ?
Take a look at the attached files. (For the sequence to work, you'll have to ensure that the two calls to Timer.vi go to the right path.)
AutoTest is set to run until the the AutoTestFlag is reset. Both MainSequence and AutoTest call "Timer.vi" which is reentrant. Both steps have the "Use Lock to Allow..." set with the name "lock".
When you run MainSequence, you can see that each sequence takes turns running Timer.vi and displaying which sequence made the call.
To experiment further, you can uncheck the "Use Lock to Allow..." options. If you run MainSequence in this case, you'll see two instances of Timer.vi.
In your specific application, for any communication step, just use the lock option with the same lock name across your different threads.