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();
}