home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / SigHandling / releaseSigs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-17  |  1.3 KB  |  47 lines

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3.  
  4. #undef integer        /* Silly stdtypes */
  5. #include "Kernel/h/stdTypes.h"
  6. #include "Kernel/h/kEvents.h"
  7. #include "Kernel/h/kmdTypes.h"
  8.  
  9. #ifndef xkernel
  10. /*
  11.  * ReleaseSigs1
  12.  *
  13.  * Releases signals held by HoldSigs.  If a signal came in while the
  14.  * signals were being held, the handler will be called at this point.
  15.  * ReleaseSigs1 is called by the ReleaseSigs macro only when some signal
  16.  * is pending.
  17.  */
  18.  
  19. void ReleaseSigs1()
  20. {
  21.     int i, p;
  22.     
  23.     if (!SigsHeld) {
  24.         ErrMsg("Call to ReleaseSigs1 with signals not held\n");
  25.         HoldSigs();
  26.     }
  27.     
  28.     do {
  29.             DebugMsg(5, "Releasing signals. %s\n",
  30.                 Pending ? "Signals pending" : "None pending (?)");
  31.             Pending = 0; /* A signal arriving here has either caused
  32.                             SigTable[sig].NTimes > 0  or Pending=1.
  33.                             so either it is processed by the inner loop
  34.                             or it causes the outer loop to repeat. */
  35.  
  36.         for (i=0, p=ActSig[0]; i < ActCount; i++, p=ActSig[i]) {
  37.         while ( SigTable[p].Ntimes > 0 ) {
  38.                         DebugMsg(5, "  Calling handler for signal %d\n", p);
  39.             SigTable[p].Ntimes--;
  40.             (SigTable[p].Handler)(i);
  41.         }
  42.         }
  43.     } while ( SigsHeld = Pending);  /* Assignment MUST be performed
  44.                                         atomically: Check generated code! */
  45. }
  46. #endif
  47.