NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in new thread should terminate execution

Solved!
Go to solution

Hi,

 

I have a labview VI (continous while loop), which is getting initialized in  subsequence of Initialize section of main sequence, and running in New thread. An error in this loop execution will stop the VI execution, pass the error to Teststand and exit the thread. I need to terminate the execution of main sequence also, at the event of error in the new thread(happening in initialize). Is there any way to do that? I am getting Standard Teststand error popup, at the event of error, but when i choose to terminate/Abort, the main sequence execution is not stopping and continues . What is the proper way of handling errors for threads running in parallel?

 

Thanks&Regards,

Juvin Ronny

0 Kudos
Message 1 of 4
(5,334 Views)
Solution
Accepted by topic author Juvin

A couple of approaches.

 

1) Wait on the new thread periodically with a wait step with a zero timeout and the "timeout causes error" checkbox unchecked. If the thread is complete and has an error, the wait step will propagate the error to the main thread.

 

2) Call Execution.Terminate() or Execution.Abort() from the cleanup of your newthread sequence.

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 4
(5,315 Views)

In addition to what Dug suggested there is a station options.

Configure -->station options  which will pop up a dialog.

At the bottom there is an option "On runtime Error" - if you select cleanup then always automatically cleanup is run on an error ( it will happen to any sequence run on that computer if you set it).

 

Always prefer terminate and not abort.

Terminate ensures that cleanup section is run ( which should cleanup hardware handles\references if any).

 

Hope this helps.

 

Ravi

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

Thanks Doug. The second solution seems to work perfectly for my case.

 

0 Kudos
Message 4 of 4
(5,295 Views)