OSF DCE Application Development Guide--Introduction and Style Guide
A Sample Application
}
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug7,
"Exiting server_bind_cleanup()"));
}
/****************************************************************************/
/* End of server init and cleanup functions */
/****************************************************************************/
/******
*
* signal_handler -- Thread to handle asynchronous interrupts.
*
* Catch and handle SIGINT and SIGTERM. Note that we
* don’t use sigaction() here because it won’t work with
* asynchronous signals. Also note that signals must be
* blocked prior to being waited for.
*
*
* The thread that runs this function is started in main().
*
******/
void signal_handler(char *arg)
{
sigset_t signals; /* Set of signals available to the application. */
int sig;
unsigned32 status;
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug7,
"Entering signal_handler()"));
status = error_status_ok;
/* Initialize the signal set... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sigemptyset()"));
sigemptyset(&signals);
/* Add SIGINT to signal set... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sigaddset()"));
sigaddset(&signals, SIGINT);
/* Add SIGTERM to signal set... */
DCE_SVC_DEBUG((smp_svc_handle, smp_s_server, svc_c_debug4,
"Calling sigaddset()"));
124246 Tandem Computers Incorporated A− 57