1: # include   <useful.h>
   2: # include   <signal.h>
   3: # include   <sccs.h>
   4: 
   5: SCCSID(@(#)rub.c	8.1	12/31/84)
   6: 
   7: /*
   8: **  RUB -- handle interrupt signals
   9: **
  10: **	This routine arranges to handle the interrupt signal
  11: **	on behalf of the CM.  It sends SYNC blocks to everyone
  12: **	who ought to get them, and arranges to ignore all
  13: **	blocks except SYNC (and RESET) blocks from everyone
  14: **	who will be sending one.  It also calls all of the
  15: **	interrupt functions for all active modules.  It does
  16: **	this after writing all of the sync blocks, so an
  17: **	interrupt function can safely issue a query if it
  18: **	wants.  It then does a non-local goto to the top of
  19: **	the main loop.
  20: **
  21: **	Parameters:
  22: **		none
  23: **
  24: **	Returns:
  25: **		non-local
  26: **
  27: **	Side Effects:
  28: **		Proc_name gets set to the CM name.
  29: **		Interrupt functions for all active modules
  30: **			are invoked.
  31: **		The 'Syncs' vector is updated appropriately.
  32: **		SYNC blocks are sent to all adjacent processes.
  33: **
  34: **	Called By:
  35: **		System, via 'signal' (section 2).
  36: **
  37: **	Trace Flags:
  38: **		none
  39: */
  40: 
  41: int RubLevel;   /* depth of ruboff calls, -1 if off */
  42: char    *RubWhy;    /* why are interrupts disabled */
  43: int RubGot;     /* set if we have an unprocessed interrupt */
  44: 
  45: rubcatch()
  46: {
  47:     /* ignore interrupts while we are processing */
  48:     signal(SIGINT, SIG_IGN);
  49: 
  50:     /* find out if we are allowing interrupts */
  51:     if (RubLevel < 0)
  52:         syserr("bad SIGINT");
  53:     else if (RubLevel > 0)
  54:     {
  55:         /* save interrupt for later processing */
  56:         RubGot++;
  57:         if (RubWhy != NULL)
  58:             printf("Rubout locked out (%s in progress)\n", RubWhy);
  59:     }
  60:     else
  61:     {
  62:         /* do other processing (either from ctlmod or standalones) */
  63:         rubproc();
  64:         syserr("rubcatch: rubproc");
  65:     }
  66: }
  67: /*
  68: **  TURN RUBOUTS OFF
  69: **
  70: **	Further rubouts will be caught by rubsave.
  71: **	The parameter should be the name of the processor which
  72: **	insists that rubouts do not occur.
  73: */
  74: 
  75: ruboff(why)
  76: char    *why;
  77: {
  78:     /* check to see if this should be ignored */
  79:     if (RubLevel < 0 || RubLevel++ > 0)
  80:         return;
  81: 
  82:     /* set up to ignore interrupts */
  83:     RubGot = 0;
  84:     RubWhy = why;
  85: }
  86: /*
  87: **  TURN RUBOUTS BACK ON
  88: **
  89: **	Rubout processing is restored to the norm (calling rubcatch).
  90: **	If any rubouts have occured while disabled, they are processed
  91: **	now.
  92: */
  93: 
  94: rubon()
  95: {
  96:     /* check to see if we should leave as-is */
  97:     if (RubLevel < 0 || --RubLevel > 0)
  98:         return;
  99: 
 100:     /* process any old interrupts */
 101:     if (RubGot > 0)
 102:         rubcatch();
 103: 
 104:     /* reset state */
 105:     RubWhy = NULL;
 106: }

Defined functions

rubcatch defined in line 45; used 3 times
ruboff defined in line 75; never used
rubon defined in line 94; never used

Defined variables

RubGot defined in line 43; used 3 times
RubLevel defined in line 41; used 6 times
RubWhy defined in line 42; used 4 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 564
Valid CSS Valid XHTML 1.0 Strict