Stepping the event loop?
Stepping the event loop?
- Subject: Stepping the event loop?
- From: Jo Meder <email@hidden>
- Date: Thu, 11 Jun 2009 23:04:03 +1200
Hi,
Although I'm ashamed to admit it, there are certain parts of our
application that rely on stepping the event loop "manually" to
maintain interactivity during intensive processing. It actually
worked pretty well. Eventually I would hope that all such processing
can be moved off onto secondary threads but unfortunately that isn't
practical right now, so I need to reproduce this cringeworthy
behaviour in Cocoa.
One way which occurs to me is create a custom event loop in Cocoa but
from the few examples I've seen of that it looks like it could be a
bit more involved than with Carbon, or at the very least people are
far more hesitant about doing it. Our app did have a custom Carbon
event loop so it could do various things, but happily I've been able
to avoid that so far with Cocoa. I have seen this as an example of
the inner loop of a custom Cocoa event loop ( from http://
cocoawithlove.com/2009/01/demystifying-nsapplication-by.html ):
[pool release];
pool = [[NSAutoreleasePool alloc] init];
NSEvent *event = [self
nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode
dequeue:YES];
[self sendEvent:event];
[self updateWindows];
which looks straightforward enough, but at this stage I don't have
the experience with Cocoa to know whether this is really sufficient.
Are there any other ways to step the event loop manually in Cocoa?
I need to support 10.4 and up.
Regards,
Jo Meder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden