Technotes


Problem with WaitNextEvent in MultiFinder 1.0



Technote TB 28November 1987



Revised by: March 1988
Written by: Jim Friedlander November 1987

This Technical Note discusses a bug in WaitNextEvent in MultiFinder 1.0. This bug only occurs when WaitNextEvent is called from the background. This bug will be fixed in the next release of MultiFinder.

Change since 11/87: the bug will be fixed in Systems with versions greater than $04FF.



In MultiFinder 1.0, applications that use WaitNextEvent:

	FUNCTION WaitNextEvent(mask: INTEGER; VAR event: EventRecord;
	                       sleep: LONGINT; mouseRgn: RgnHandle): BOOLEAN;

	pascal Boolean WaitNextEvent(mask,event,sleep,mouseRgn)
	    unsigned short mask;
	    EventRecord *event;
	    unsigned long sleep;
	    RgnHandle mouseRgn;

should not call WaitNextEvent from the background with a value of sleep that is greater than 50. This value has been determined empirically for a Macintosh II; larger values can be used on the Macintosh Plus and the Macintosh SE. If an application uses a large value of sleep when running in the background, MultiFinder 1.0 will hang under the following circumstances:

* The application that is calling WaitNextEvent with a large sleep value has been put in the background.

* That application becomes the foreground application when another application (including the desk accessory handler) quits.

If you use a value of sleep that is small enough, this problem will not occur. If you use an algorithm to calculate sleep, make sure that the maximum is clipped to 50.

This problem will be fixed in the next release of MultiFinder. You can call SysEnvirons to test for the system version number. This bug will not happen when the System version is greater than $04FF.


Further Reference:




Technotes
Previous Technote | Contents | Next Technote