summaryrefslogtreecommitdiff
path: root/netsvcs/servers/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'netsvcs/servers/main.cpp')
-rw-r--r--netsvcs/servers/main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/netsvcs/servers/main.cpp b/netsvcs/servers/main.cpp
index c072d012211..130b7f1ab30 100644
--- a/netsvcs/servers/main.cpp
+++ b/netsvcs/servers/main.cpp
@@ -1,6 +1,6 @@
-#include "ace/Service_Config.h"
// $Id$
+#include "ace/Service_Config.h"
#include "TS_Clerk_Handler.h"
#include "TS_Server_Handler.h"
#include "Client_Logging_Handler.h"
@@ -69,6 +69,17 @@ main (int argc, char *argv[])
}
}
+ // Create an adapter to end the event loop.
+ ACE_Sig_Adapter sa ((ACE_Sig_Handler_Ex) ACE_Service_Config::end_reactor_event_loop);
+
+ ACE_Sig_Set sig_set;
+ sig_set.sig_add (SIGINT);
+ sig_set.sig_add (SIGQUIT);
+
+ // Register ourselves to receive SIGINT and SIGQUIT so we can shut
+ // down gracefully via signals.
+ ACE_Service_Config::reactor ()->register_handler (sig_set, &sa);
+
// Run forever, performing the configured services until we are shut
// down by a SIGINT/SIGQUIT signal.