Fix bug #3537. Replaced call of Delay() with WaitNextEvent() so that we'll yield to other processes if we're in some long wait for i/o.
authorsdagley%netscape.com
Thu, 22 Jul 1999 21:28:34 +0000
changeset 723 ff0efd11439a26793abc92ccc76b512034cc64b2
parent 722 d067554b94636f3b141bef07b8d895eba23ff2c4
child 732 9f3962adb6db39b6f13fcd4c6e91698a502838e2
push idunknown
push userunknown
push dateunknown
bugs3537
Fix bug #3537. Replaced call of Delay() with WaitNextEvent() so that we'll yield to other processes if we're in some long wait for i/o.
pr/src/md/mac/macthr.c
--- a/pr/src/md/mac/macthr.c
+++ b/pr/src/md/mac/macthr.c
@@ -191,20 +191,31 @@ void _MD_StopInterrupts(void)
 		gTimeManagerTaskElem.tmAddr = NULL;
 	}
 }
 
 void _MD_PauseCPU(PRIntervalTime timeout)
 {
 #pragma unused (timeout)
 
-	unsigned long finalTicks;
+	/* unsigned long finalTicks; */
+	EventRecord theEvent;
 	
 	if (timeout != PR_INTERVAL_NO_WAIT) {
-	    Delay(1,&finalTicks);
+	   /* Delay(1,&finalTicks); */
+	   
+	   /*
+	   ** Rather than calling Delay() which basically just wedges the processor
+	   ** we'll instead call WaitNextEvent() with a mask that ignores all events
+	   ** which gives other apps a chance to get time rather than just locking up
+	   ** the machine when we're waiting for a long time (or in an infinite loop,
+	   ** whichever comes first)
+	   */
+	   (void)WaitNextEvent(nullEvent, &theEvent, 1, NULL);
+	   
 	    (void) _MD_IOInterrupt();
 	}
 }
 
 
 //##############################################################################
 //##############################################################################
 #pragma mark -