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 #39844 is a reply to message #37163] Sun, 05 May 2013 20:20 Go to previous messageGo to previous message
Zbych is currently offline  Zbych
Messages: 326
Registered: July 2009
Senior Member
Hi,

I made some tests and it is possible to close skylark nicely, but there are two problems. First - quit flag is private, second "main" function waits for all threads in application.

Mirek, can you add Quit (public) method to skylark and modify Main?

void SkylarkApp::Quit()
{
	quit = true;
#ifdef PLATFORM_POSIX
	Broadcast(SIGTERM);
#endif
	TcpSocket s;
	s.Timeout(100);
	s.Connect("127.0.0.1", port);
}


void SkylarkApp::Main()
{
	Buffer<Thread> uwt(threads);
	for(int i = 0; i < threads; i++)
		uwt[i].Run(THISBACK(ThreadRun));
	
	/* Wait for threads to shut down */
	for (int i = 0; i < threads; i++)
		uwt[i].Wait();
}


 
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: Mon May 13 07:25:16 CEST 2024

Total time taken to generate the page: 0.01559 seconds