Example Program Drafts

Showing results for 
Search instead for 
Did you mean: 

Run a TestStand sequence only if it is not already running

by Active Participant Al.B on ‎10-24-2011 09:30 PM

It is fairly easy to call a specified sequence using the TestStand API using the Execution.newThread method:

Execution.NewThread ( sequenceFileParam, sequenceNameParam, options, sequenceContextParam = NULL, se...

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:

  1. get a reference to all threads in the current execution
  2. check the sequence name and sequence file path of each existing thread against the specified values
  3. 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.