07-20-2016 10:42 AM
I have multiple threads running - I only want the first one turning a certain device on and the rest of them just skipping this sub-sequence.
Rather than designing a system of flags - I was hoping there is a way to rig syncronization behavior similar to the batch synchronization option of "one thread only"?
Is there a way to have all the sequence by pass the step at the end that turns this device off and the last one executing the turn off?
Solved! Go to Solution.
07-20-2016 11:08 AM - last edited on 10-20-2024 07:41 PM by Content Cleaner
Hi rsmrostov-
Refer to this topic: https://forums.ni.com/t5/NI-TestStand/Implementation-of-synchronization-steps-without-using-batch-or...
Batch Synchronization Step Types will only work when using the Batch Process Model (without additional implementation on your part to synchronize the threads executing in the Parallel Process Model).
TestStand offers the Batch Specification step to define a group of threads; enabling you to perform Batch Synchronization in a non-Batch Process Model. Refer to the attached Sequence File for a reference to an implementation using Batch Specification steps.
-Jeff
07-20-2016 11:09 AM
Move it to the ProcessSetup and ProcessCleanup callbacks. That way it will only occur once because these happen before and after the threading.
If you cannot move it to those callbacks then I would recommend you use the batch model. Synchronizing the parallel model for this purpose within the threading voids the purpose of the parallel model. At that point you may as well do the batch.
Hope this helps,
07-20-2016 12:17 PM
Thank you so much, that's exactly what I need!!!
07-20-2016 02:49 PM
may be I jumped the gun - with what you are suggesting all threads still go into the sequence, only doing it 1 by 1....I need the first one to go in, and the rest to skip.
07-20-2016 02:50 PM - edited 07-20-2016 02:51 PM
Neither one is feasible for me:
I can't touch the process model - because this will alter the behaviour of the rest of the tests
I can't change the process model for the same reason as above.
07-20-2016 02:55 PM
rsmrostov-
In that case, just put the SequenceCall step inside the Batch Synchronization section (see attached image for an example).
-Jeff
07-21-2016 05:53 AM - edited 07-21-2016 05:54 AM
That is exactly what I am doing - what I am observing is one thread enters the batch - executes, other one waits, than also enters the batch and executes - what you gave me works like a lock functionality.
Even if you run the example you have given me - you can run each SN through your batch, while the goal is to execute the first one that comes in and bypass all others
07-21-2016 08:11 AM - edited 07-21-2016 08:11 AM
Ignore this post. It was an accident.
07-21-2016 08:11 AM
Do you need to synchronize the threads at that point? If so then I'd recommend using a rendezvous. I've thrown together a little example. Check it out.