OSF DCE Application Development Guide--Introduction and Style Guide
Threads
/*
* This is run by the signal catcher thread to handle async signals.
* We don’t use sigaction() here because it won’t work with
* async signals. Note that signals must be blocked prior to being
* waited for.
*/
void signal_catcher(char *arg)
{
sigset_t signals;
int sig;
sigemptyset(&signals);
/* In this sample, we’ll catch only SIGINT... */
sigaddset(&signals, SIGINT);
sigprocmask(SIG_BLOCK, &signals, NULL);*/
while(1)
{
sig = sigwait(&signals);
switch(sig)
{
case SIGINT:
/* SIGINT specific actions here. */
.
.
.
break;
default:
/* Not reached. If we were waiting on other */
/* signals. this would establish a default action */
/* to exit ... */
continue;
}
break;
}
sigprocmask(SIG_UNBLOCK, &signals, NULL);
/* Do termination clean up here. */
.
.
.
exit(1);
}
124246 Tandem Computers Incorporated 2− 17










