Ctrl+C handling
Handle SIGINT via ACE
extern "C" void handler (int)
{ACE_DEBUG ((LM_DEBUG, "%s\n", __FUNCTION__));
// shutdown application
}
extern "C" void handler (int)
{ACE_DEBUG ((LM_DEBUG, "%s\n", __FUNCTION__));
// shutdown application
}
ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
Handle SIGINT via boost.asio
void handler(
const boost::system::error_code& error,
int signal_number)
{
if (!error)
{
// A signal occurred.
}
}
boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
signals.async_wait(handler);
Windows Console application, see CTRL_C_EVENT and SetConsoleCtrlHandler.
0 Comments:
Post a Comment
<< Home