mac3n@babbage.acc.virginia.edu (Alex Colvin) (05/16/88)
Sorry about the spelling in that last note.
Also, what I really wanted to show is how to use such a test-and-set IFLAG
routine:
For example:
/* uninterupted read & clear long
 * good for counting interrupts, etc.
 * NOT safe against other processors
 */
long lreset(long *lp)
  { long l;             /* old value */
    int f;              /* saved IFLAG */
    f = intrflag(0);    /* inhibit */
    l = *lp; *lp = 0;   /* read & clear */
    intrflag(f);        /* restore flag */
    return l;
    }
This can be called with interrupts enabled or disabled.  It returns in the
same state.  In the meantime, it disables ("inhibits") for a while.
				-- INHIBIT SAVE,ON
				-- ...
				-- INHIBIT RESTORE