[comp.sys.mac.programmer] Tech Note 202

bin@primate.wisc.edu (Brain in Neutral) (01/05/91)

Tech Note 202 (Resetting the Event Mask) says the event mask should be
saved/restored at the beginning/end of a program that modifies it, e.g.,

	# define SysEvtMask 0x0144

	saveMask = * ((Integer *) SysEvtMask;
	...
	SetEventMask (newMask);
	...
	* ((Integer *) SysEvtMask = saveMask

My question: why not just reset at the end with SetEventMask (saveMask)?
Is there some difference between that and setting the low memory global
directly?

-- 
Paul DuBois
dubois@primate.wisc.edu

phils@chaos.cs.brandeis.edu (Phil Shapiro) (01/05/91)

In article <3687@uakari.primate.wisc.edu> bin@primate.wisc.edu (Brain in Neutral) writes:
   Tech Note 202 (Resetting the Event Mask) says the event mask should be
   saved/restored at the beginning/end of a program that modifies it, e.g.,

	   # define SysEvtMask 0x0144

	   saveMask = * ((Integer *) SysEvtMask;
	   ...
	   SetEventMask (newMask);
	   ...
	   * ((Integer *) SysEvtMask = saveMask

   My question: why not just reset at the end with SetEventMask (saveMask)?
   Is there some difference between that and setting the low memory global
   directly?

There's no difference, SetEventMask() is [Not in ROM] -- it's
implemented with glue that writes directly to the low memory global.
I would still use the function instead, just in case this changes.
The tech note writers were probably just being absent-minded.  BTW,
you can skip some hassle and use the definition of SysEvtMask() from
EventMgr.h, if you're using Think C.

	-phil
--
	   Phil Shapiro                           Technical Support Analyst
	   Language Products Group                     Symantec Corporation
		Internet: phils@chaos.cs.brandeis.edu

-- 
	   Phil Shapiro                           Technical Support Analyst
	   Language Products Group                     Symantec Corporation
		Internet: phils@chaos.cs.brandeis.edu