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 » U++ Library support » U++ MT-multithreading and servers » How to close Skylark server except using Ctrl+C
Re: How to close Skylark server except using Ctrl+C [message #39855 is a reply to message #39844] Tue, 07 May 2013 04:30 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
At least for my application in C++ and Java is to shut down threads INSIDE each individual thread.

void endX(){
	endApp = true;	
	snd("clear61", 0);	
	Sleep(200);
	snd("clear62", 0);	
	Sleep(200);
	snd("clear63", 0);	
	Sleep(200);
	snd("clear64", 0);	
	Sleep(200);
	snd("clear", 0);	
	Sleep(2000);
	if(CommPort1.IsOpened()) CommPort1.Close();
	if(CommPort2.IsOpened()) CommPort2.Close();
}	

GUI_APP_MAIN{
	NefbG2().Run();
	endX();
}


And in each thread something like this:
		while(!inF.IsEof()){
		    if(endApp){if(inF) inF.Close(); break;}
    		    if(Thread::IsShutdownThreads() || cF==1){
			if(inF) inF.Close();
	    	        cF=0;
	    	        break;
		    }


Hope this helps as if an app opens a port and it is not closed properly it stays open when the app closes, plus other things happen that IS NOT nice to contend to.

edit: As mentioned try and close the threads inside the thread.
This is when the app exits or even to end a thread while the app is running.

[Updated on: Tue, 07 May 2013 04:41]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Skylark and GUI in one app - need some advices
Next Topic: Fatal error - GuiLock
Goto Forum:
  


Current Time: Sun May 12 17:49:52 CEST 2024

Total time taken to generate the page: 0.01282 seconds