It is fairly easy to call a specified sequence using the TestStand API using the Execution.newThread method:
With this method, we provide the sequence file reference and the name of the sequence to run, and TestStand executes the sequence in a new thread. If we call this method on a sequence that is already running, TestStand still creates a new thread. Many times, this is the desired behavior, but what if we instead want to get the existing thread reference if the specified sequence is already running, rather than creating a second thread?
The attached module (written in LabVIEW) demonstrates a method of checking whether a sequence is running, and only creating a new thread in the case that it is not. The general flow of the module is:
- get a reference to all threads in the current execution
- check the sequence name and sequence file path of each existing thread against the specified values
- if the values don't match an existing thread, create a new thread, otherwise, return a reference to the existing thread using the specified sequence
a sequence demonstrating how the module works is also attached.