05-08-2007 01:14 PM
05-09-2007 12:21 AM
Hi,
So is the GUI still running when you are seeing these cleanups run?
Regards
Ray Farmer
05-09-2007 08:58 AM
Yes.
I though have made one change and it seems to be working. When calling MainThread in MainSequence now I have checked the box to automatically wait for the thread to complete at the end of current sequence. With this box checked now it seems to be calling the cleanup of MainThread now as well. Any ideas why this check box can make such a difference.
Thanks
Ifti
05-09-2007 09:55 AM
Hi,
The MainThread sequence needs to complete ie return back from the GUI to allow it to complete and run the Cleanup.
Regards
Ray Farmer
05-09-2007 10:03 AM
Thanks.
This requirement would have met even without checking the box in MainSequence. Why does the check box make a difference?
05-09-2007 01:26 PM
05-09-2007 01:58 PM
I had been using Local object reference for the thread and using Wait with that object. But now I am doing both automatically with the checkbox and Wait with object reference. This combination seems to be working so I will stick with this.
Ifti
05-09-2007 03:47 PM
The combination is working. I was though able to get more information about the earlier problem.
The issue that I was seeing occured on the timing of Execute.Terminate() being called
The following was the flow
MainSequence calls MainThread in STA thread. MainThread called another sequence 'Alignment' specified in a separate file. 'Alignment' in turn called another sequence 'Load' in a separate file. Load in turn called 'LoadThread' in a separate thread. LoadThread calls a dll function(not the same dll as GUI) which is resposible for loading a file to a device. This loading via dll call takes around 45 to 60 seconds. I encounter the problem only if Termiante is called when this file loading is taking place. Please note that 'Load' and 'LoadThread' are in the same sequence file.
I could see cleanup functions of all these sequences being called except for MainThread. I could the cleanups for 'Load' , LoadThread and Alignment taking sometime to start probably waiting for the dll call to complete.
Any further ideas regarding what exactly might have been the issue regarding MainThread cleanup not being called.
Ifti
05-10-2007 01:58 AM
Hi,
In summary:
MainSequence calls
MainThread (Current)(in new thread)
calls a dll (GUI)
Calls Alignment sequence (seperate seqFile)
Calls Load (seperate seqfile)
Calls LoadThread (Current) (in new Thread)
Call dll
In MainSequence if there is no Wait step in the Cleanup then the Cleanup will be executed once the MainThread has been executed and returned. So this is the first cleanup to be run.
In MainThread, does the call of the dll to launch the GUI return straight away or wait for the GUI to close?
I am assuming it returns straight away to allow Alignment to be called after calling the GUI.
If this is the case, do you have a Wait in MainThread to wait for the GUI to close before completing it's cleanup. If not then MainThreads cleanup will be called once the cleanup of Alignment has completed.
Regards
Ray Farmer