04-18-2009 11:28 AM
Hi,
at present my data acquisition program consists of several floating panels, one is the 'main' panel, and then there are other 'instrument panels' that operate individual instruments (one panel per instrument type).
Now I have studied the sample 'multipanel' because I wanted to operate my 'instrument panels' in individual threads. I succeeded only partially. I can start the threads via CmtScheduleThreadPoolFunction, and run each panel using its own RunUserInterface. And I can quit the individual user interfaces by their respective 'quit' button.
What I can not do (and the NI sample doesn't do it either) is to automatically close all the individual instrument panels simply by closing the main panel. In the sample, the main panel may be closed, but the chart panel keeps running. How could it be achieved in the sample that by closing the main panel the chart panel quits, too?
Thanks a lot!
Wolfgang
Solved! Go to Solution.
04-18-2009 04:15 PM - edited 04-18-2009 04:20 PM
Inside Multipanel sample, 'Exit function' button contains a function to terminate a thread from the main thread, so you can mimic this function behaviour to obtain your goal: terminating all secondary threads before teminating your application.
Take a look at the modified version of multipanel that I am attaching. I relied on NotifyThreadFunctionExecState () function which is used in the example to conveniently populate the list of active threads: I have added to it a active thread counter so that I am sure that all threads are effectively terminated before exiting the main thread.
04-19-2009 02:31 AM
Hi Roberto,
I'll be able to look at your code only tomorrow, but let me thank you already now: providing a custom example is more than just nice: I really appreciate it a lot!
Wolfgang
04-20-2009 01:55 AM
04-20-2009 02:14 AM