XQuartz: Avoid a possible spinlock in applicationWillTerminate

(cherry picked from commit f430cda0fdcc1a8fc5f4795743b40f09ff0bd869)
This commit is contained in:
Jeremy Huddleston 2009-07-28 22:52:33 -07:00
parent 1e49c8d340
commit a85523dc50

View File

@ -781,13 +781,16 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (void) applicationWillTerminate:(NSNotification *)aNotification - (void) applicationWillTerminate:(NSNotification *)aNotification
{ {
unsigned remain;
[X11App prefs_synchronize]; [X11App prefs_synchronize];
/* shutdown the X server, it will exit () for us. */ /* shutdown the X server, it will exit () for us. */
DarwinSendDDXEvent(kXquartzQuit, 0); DarwinSendDDXEvent(kXquartzQuit, 0);
/* In case it doesn't, exit anyway after a while. */ /* In case it doesn't, exit anyway after a while. */
while (sleep (10) != 0) ; remain = 10000000;
while((remain = usleep(remain)) > 0);
exit (1); exit (1);
} }