NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

LV6.1, TS2.0.1, how do I wait for a frontend callback called from LV to complete? WaitForEndEx does not seem to wait.

I need to run a TS sequence just before exiting my operator interface (a modified version of the full featured OI). I use InvokeNode to call it in my "Exit" case, with the CallFrontEndCallbackEx method. I wire the Execution output from the method to call Execution.WaitForEndEx, with a timeout of -1 (no timeout), and I expect for it not to come back before the callback completes. But it does come back before completion, apparently, and since the next thing I do is request a shutdown, I get a message 'Cannot exit while a sequence is running' and the application hangs. If I force a delay or simply remove the code that calls the callback, I don't get th
e same problem.
(In the attached code example, ignore the fact that we're getting the Execution.Id and not using it - we know that should be removed.)
0 Kudos
Message 1 of 2
(2,875 Views)
I accidentally posted this question twice - so now I'll post what my NI engineer and I found out about this. Execution.WaitForEndEx did indeed wait for the end of the sequence execution, but at the end of the execution there are some UI messages that get fired. Without processing those UI messages, the sequence is technically not finished. Since the very next thing I do after calling this is to place the Shutdown command on the queue, the shutdown command was being processed BEFORE the UI message indicating the end of the sequence callback execution. The solution I came up with was to place a "No Event" command on the queue before the "Shutdown" command. The "No Event" allowed the UI messages to get processed first. Then the shutdown command no longer appeared to
be running before the end of the sequence.
Message 2 of 2
(2,875 Views)