Interrupt Handler in 'C'

Dave Jones djones at megatest.UUCP
Thu Mar 9 13:51:03 AEST 1989


I just realized that I don't have to call
sigsetmask to get the old signal-mask. It's
available in the struct sigcontext:


 sigalrm_handler(sig,code,context)
   struct sigcontext *scp;
 {
   static int handler_active = 0;
   static jmp_buf first_handler;
   int handler_mask;

   if(handler_active) longjmp(first_handler, 1);

   handler_active = 1;
   setjmp(first_handler);

   handler_mask = sigsetmask(scp->sc_mask);
   B();
   sigsetmask(handler_mask);

   handler_active = 0;
 }



More information about the Comp.unix.questions mailing list