Installing a signal callback

A signal callback is installed only at the context level. Signal callbacks are identified by adding the signal number on to the defined constant CS_SIGNAL_CB.

The following routine demonstrates how to install a signal callback:

          /*
           ** INSTALLSIGNALCB
           **
           ** This routine installs a signal callback for the
           ** specified signal
           **
           ** Parameters:
           **      cp   Context handle
           **      signo   Signal number
           **      signalhandler   Signal handler to install
           **
           ** Returns:
           **      CS_SUCCEED   Signal handler was installed
           **                   successfully
           **      CS_FAIL      An error was detected while
           **                   installing the signal handler
           */
           CS_RETCODE  installsignalcb(cp, signo, signalhandler)
           CS_CONTEXT  *cp;
           CS_INT  signo;
           CS_VOID *signalhandler;
           {
                CS_INT       adjustedsigno;
                CS_RETCODE   ret;
               /*
                ** Add the signal number to the CS_SIGNAL_CB 
                ** define to indicate the signal number that this
                ** handler is being installed for.
                */
                adjustedsigno = CS_SIGNAL_CB + signo;
               ret = ct_callback(cp, (CS_CONNECTION *)NULL,
                     CS_SET, adjustedsigno, signalhandler);
               return(ret);
           }