01-05-2009 01:43 AM
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!
Solved! Go to Solution.
01-05-2009 12:37 PM
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
01-05-2009 11:27 PM
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.
01-06-2009 10:07 AM
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
01-07-2009 01:29 PM
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