02-16-2015 03:29 AM
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
Solved! Go to Solution.
02-16-2015 09:46 AM - edited 02-16-2015 09:48 AM
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
02-16-2015 01:14 PM
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
02-17-2015 12:00 AM
Thanks Doug. The second solution seems to work perfectly for my case.