LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

slow close times

Solved!
Go to solution

Hey everyone.  I'm seeing some strange behavior, somewhat related to an old question of mine.

 

My app is maybe 4-5000 lines total, with a dozen control arrays, and maybe 100-150 controls.  So it's not gigantic, but it's fairly good sized.

 

Oddity: I'm seeing some very long application shutdown times.  That is, when I close the app with an exit button control, or from the app's Windows titlebar "X" icon, or from the menu, I can step through the process and I see several of the callbacks get called spuriously.  I believe that since these callbacks are getting called "one last time", it's probably adding up to the observed 13-14 seconds of shutdown time!

 

In the other post above, there was talk about including the "default: return 0;" case.  I like that and have included in all my major state machine timers.  Yet I'm still unable to shut down the app immediately.

 

Another observation: if I breakpoint right on the CloseCVIRTE line, I'm seeing a near zero time delay between clicking Close and this line.  It's after the CloseCVIRTE that the program hangs for 13 seconds.  And this portion isn't traceable.

 

My main loop skeleton:

 

int main (int argc, char *argv[])
{
	if (InitCVIRTE (0, argv, 0) == 0)
		return -1;  // out of memory error
	
	if (mainPanel < 0)
		return -1;  // out of memory error

	// display the GUI
	DisplayPanel(mainPanel);

	RunUserInterface();
	
	// close the GUI
	DiscardPanel(mainPanel);
	CloseCVIRTE();
	return 0;
}

 

Ideas?

0 Kudos
Message 1 of 2
(2,927 Views)
Solution
Accepted by topic author ElectroLund

No real idea. I have observed myself this same phenomenon, shorter in time but indeed notable, and noted that if I explicity free all allocated resources exit time is a little bit faster. With that I mean:

 

  • Free all dynamic memory
  • Close files
  • Close serial port if any
  • Dispose of all panels, menus and so on
  • Discard DAQmx handles, tasks and so on
  • Discard all thread locks, thread function IDs, thread pools...
  • ...


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 2
(2,918 Views)