NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Terminating Non-Reentrant vi:s in TestStand using the TerminateAll function

Solved!
Go to solution

Hello!

 

What does the Terminate All function in TS do (The one under debug)?

I have some problems with the Terminate All function and non-reentrant vi:s, explained below. See attached files for a simple example of my problem.

 

I wanted to have a vi non-reentrant but encountered a problem with the built in Terminate All function.

When I run the same vi in three threads, one thread executes the vi while the other two wait for it to complete (as expected with non-reentrant). When I Terminate the execution however, only one (or two) of the three threads are terminated, while the other(s) are stuck (Note: I use TS Termination monitor to exit the vi) .

 

I have attached a simple example where I have a simple vi with a while loop, waiting for TS termination.  The Sequence file is set to use ParallelModel.Seq as Model. If I use the Models built in termination everything is terminated as expected (It terminates every thread separately). However if I use TS debug "Terminate All" only 1-2 of the threads are terminated. 

 

Thanks in advance.

Download All
0 Kudos
Message 1 of 3
(2,322 Views)
Solution
Accepted by topic author Joel_V

Hello,

 

I tried your code. By getting the executions states before starting the termination monitor, I see for 2ond and 3rd VI call that termState is ExecTermState_Terminating (GetStates method). So if different of ExecTermState_Normal, you can choose not to call the Termination monitor and associated loop.

 

 

Termination.png

 

Hope this helps,

Message 2 of 3
(2,267 Views)

Works like a charm.

 

Implemented it inside the loop in my other vi:s and they stop as expected. Smiley Happy

I find it weird that Execution termination state is terminating but termination monitor return false, but your had a simple solution to that.

 

Thanks a lot!

0 Kudos
Message 3 of 3
(2,217 Views)