Re: Stacking run loops
Re: Stacking run loops
- Subject: Re: Stacking run loops
- From: Ricky Sharp <email@hidden>
- Date: Thu, 23 Dec 2004 08:40:26 -0600
On Dec 16, 2004, at 7:45 AM, Ricky Sharp wrote:
On Thursday, December 16, 2004, at 07:39AM, Ricky Sharp
<email@hidden> wrote:
Ultimately, I decided to do things manually with my own local event
loop:
modalLoopDone = NO; // iVar
do
{
NSAutoreleasePool* thePool = [[NSAutoreleasePool alloc] init];
NSEvent* theEvent = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantPast] inMode:NSEventTrackingRunLoopMode
dequeue:YES];
typo...inMode is actually set to NSDefaultRunLoopMode
[NSApp sendEvent:theEvent];
[thePool release];
}
while (!modalLoopDone);
Answering my own thread for the sake of the archives...
This loop is very bad in that it needlessly wastes CPU. For what I
need, I'm now using distantFuture for my date.
The revised code is now:
modalLoopDone = NO; // iVar
do
{
NSAutoreleasePool* thePool = [[NSAutoreleasePool alloc] init];
NSEvent* theEvent = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode
dequeue:YES];
[NSApp sendEvent:theEvent];
[thePool release];
}
while (!modalLoopDone);
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden