Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Shutdown procedure by clicking red x
Re: Shutdown procedure by clicking red x [message #30333 is a reply to message #30002] Sat, 25 December 2010 08:44 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I had a few times when the app locked also on
Thread::ShutdownThreads(); or Thread::IsShutdownThreads()
I don't remember which but in debug just jumped from there and then stopped.
In a release it just hung and MS closed it.

This is what I changed to:
		while (CommPort.ReadDataWaiting() ) {
		    if(end) break;
		    try{
                      .... 
void endX(){end = true;	Sleep(2000);}	

GUI_APP_MAIN{
	GPSx2().Run();
	if(CommPort.IsOpened()) CommPort.Close();
	if(CommPort2.IsOpened()) CommPort2.Close();
	endX();
}

This is in a GPS tracking app that has Sleep(1000) waiting for the next sentence, if not it checks every (500) to see if the signal is regained.
The if(end) break; closes the thread with the break inside the thread.
bool end; and the void endX() are global (if that is the right term).
I did it about the same way in a TrackReplay app, triggering a break inside the thread to end it.

Maybe a hack but no problem closing since.

Your code is above me just looking at it, will study it later.
It does look like you have a break inside the thread to close it also.
StaticMutex, volatile Atomic, PostCallback, are all new to me.

Neil

[Updated on: Sat, 25 December 2010 09:17]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Copy\Paste Between Project Files Doesn't work
Next Topic: Error meaning
Goto Forum:
  


Current Time: Mon Apr 28 04:53:34 CEST 2025

Total time taken to generate the page: 0.00896 seconds