Re: NSRunLoop looping more than once?
Re: NSRunLoop looping more than once?
- Subject: Re: NSRunLoop looping more than once?
- From: John Anderson <email@hidden>
- Date: Tue, 18 Mar 2003 22:07:04 -0500
Dear Chris,
Thanks again for continuing to elucidate the finer points of Cocoa.
I find this to be bizarre. The first sentence implies that there are
further input sources in the run loop which it continues waiting on.
Yet the second sentence is a strange behavior. There's probably a bug
here (or something very subtle going on, like calling NSLog() can
change the run loop's state, so if you do that in one test and not
another, you might see different behavior).
I did have lots of NSLog() calls in the code that I used to generate
this "bizarre" NSRunLoop / NSTimer behavior. However, I just removed
them all and my results are the same for both cases (with or without
NSLog() being called):
(1) Calling [NSTimer invalidate] stops a repeating timer from firing
but [NSRunLoop runMode: beforeDate:] still does not return.
(2) Switching to a non-repeating NSTimer does cause [NSRunLoop runMode:
beforeDate:] to return after the timer fires.
But now I have to ask: How can NSLog() change a runLoop's state???
Actually using a "real" source to poke the run loop into returning is
the less-polling way to do things.
I am writing a "real-time" framework for Cocoa. So, I do not see how
I am going to avoid using at least one repeating NSTimer to drive the
code. Perhaps, the "minimal-polling" way to do "real-time" is to have
only one NSTimer driven runLoop and let it "poke" the rest of the code
via "real" sources.
Truly yours,
John Philip Anderon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.