NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Avoid Running two theards at the same time

Solved!
Go to solution

Hi

    I was wondering how to avoid running two threads at the same time in teststand.When I using teststand,I found it can run two threads simultaneity.for example,I can open one sequence file,using single pass enter point to run one theard,when this theard is not finish,I can use single pass or TestUUTs enter point to run another theard.I want to avoid this case.Does there have any parameters we can get  from teststand engine to tell me one thread is running or not?

Thank you!

   

0 Kudos
Message 1 of 5
(3,879 Views)
Solution
Accepted by topic author yiweihua2002

Are you writing a custom UI? If you are using an application manager (all of the example UIs and sequence editor do), you can check:

 

 ApplicationManager.Executions.Count > 0

 

If you are using just the engine than you can keep a count of the number of executions by incrementing your count when the UIMessage UIMsg_StartExecution is received and decrement your count when UIMsg_EndExecution is received.

 

If instead you want to determine the number of executions from a running sequence, you can use RunState.Engine.GetInternalOption() to get a reference to the Application manager (at least from UIs and the sequence editor which use an Application Manager) and then use ActiveX steps to get the Executions.Count property.

 

Hope this helps,

-Doug

Message 2 of 5
(3,863 Views)

Thank you very much!I have solved the problem.

Just like you said, I use ApplicationManager.Executions.NumRunning to get the theards of UI run(please see the picture).

 

And I want to ask how did you know this method can solve the problem?You read book or see the teststand help.

I just want to know how to solve the problem by myself.Learn some method of solve the problem.

 

Thank you very much.

0 Kudos
Message 3 of 5
(3,850 Views)

Glad you were able to get it working.

 

I recommend you check NumIncomplete instead of NumRunning as NumRunning does not include executions that are paused at a breakpoint.

 

The APIs contain many methods and properties so it is perhaps a challenge sometimes to know where to look. General purpose methods, interfaces, and properties can usually be found in the ApplicationManager or Engine interfaces so those are good starting points. Also searching the teststand help can be useful as well. Also, the documentation that comes with TestStand includes an API poster that lists the names of things so that might be useful as well. Perhaps others here might have some additional recommendations.

 

-Doug

0 Kudos
Message 4 of 5
(3,829 Views)

Another possibility if you are creating your own UI, is to disable the execution entry point buttons when an execution is started.

You can find example code implementing this in this document:  Disable Entry Point Buttons During Execution on a TestStand User Interface

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 5 of 5
(3,802 Views)