Open GoogleCodeExporter opened 9 years ago
Thanks for your patch. The runForever is a workaround, just for those testcases.
The real applications maybe use more complex solution to shutdown the server
according
to their requirements, so I left the problem to the developer himself.
Original comment by liusi...@gmail.com
on 12 Feb 2010 at 2:52
[deleted comment]
The applications maybe like the following:
static int gExitSignal = 0;
static void sigHandler(const int sig)
{
gExitSignal = sig;
}
int main( int argc, char * argv[] )
{
signal(SIGINT, sigHandler);
signal(SIGTERM, sigHandler);
signal( ...... );
......
ForkAsDaemon();
SP_LFServer server( "", port,
new SP_HttpHandlerAdapterFactory( new SP_HttpEchoHandlerFactory() ) );
......
server.run();
for( ; ; ) {
sleep( 1 );
if( 0 != gExitSignal ) {
sp_syslog( LOG_NOTICE, "exit signal %d", gExitSignal );
break;
}
}
// do something, such as to close database connection,
// to close the opening file
}
Original comment by liusi...@gmail.com
on 12 Feb 2010 at 3:02
Original issue reported on code.google.com by
artem.iglikov
on 2 Feb 2010 at 3:12