NI TestStand Idea Exchange

Showing results for 
Search instead for 
Did you mean: 

Add Rendezvous option to Batch Synchronization selections

Status: New



The current behavior of the Batch Synchronization options "One Thread Only (first thread executes step, remaining threads skip)" and "Serial (one thread at a time)" is that the threads wait at that step until all threads have gotten to that point before it executes using the selected behavior. It essentially has a rendezvous built into the step. There are many times when I want the first thread that encounters that step to perform the action immediately (and then continue, with other threads skipping that step) without waiting for the other threads to also get to that point in the test.


For example, I may have three threads running in the Batch model and when the first one gets to a certain point in the test I want it to perform some action (log activity, turn something on, etc.) that I only want to be done once. I can use the "One Thread Only" option, but this causes the test to pause until all of the threads have reached that point before it performs the action of the step (once). Additionally, the remaining threads also pause at that step until the first thread completes the activity. So the undesirable delay is twofold: the first thread doesn't run the step until the other threads have also reached that point, and the other threads now wait until that activity is completed before continuing.


It would be great to have the option to select how I want this to behave. If the rendezvous could be selectable then it would provide the desired functionality. I'm sure custom coding could create this effect somehow, but I don't see a straightforward way to have only one thread run a step (and others skip) without waiting for the other threads to arrive or the remaining threads to wait until the first completes. The "Serial" Batch Synchronization option can be implemented in a different way without major effort (using locks, rendezvous, etc.), but the "One Thread Only" with selectable rendezvous option is what is truly missing (and it may make sense to have it available for both).

1 Comment

That would be a batch synchronization step that does not synchronize. Sounds counterintuitive. Maybe batch synchronization is the wrong tool.


What about a "I was here!" - notification for the other threads?
Could be done with a notification:

- First thread sets value to 1.

- other threads skip if value is >=1 and add 1 to the value

- last thread skip if value is == NumThreads and clears value

obviously that requires that the number of active threads is known but that should be easy to know.