Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

Run a TestStand sequence only if it is not already running

Overview

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. 

 

 

Description

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?

 

 

Requirements

Software

TestStand 2012 (or compatible)

 

 

Steps to Implement or Execute Code

  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

  

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Al B.
Staff Software Engineer - TestStand
CTA/CLD