|
From: | Richard Frith-Macdonald |
Subject: | Re: NSTimer |
Date: | Fri, 27 Feb 2009 11:51:40 +0000 |
On 27 Feb 2009, at 11:15, David Chisnall wrote:
The behavior on MacOS when I tested it was strange and inconsistent ... sometime the loop returned immediately as documented, sometimes it blocked. My suspicion is that MacOS-X has an undocumented feature of sometimes putting input sources in the run loopThis is not undocumented. The NSRunloop documentation clearly states:Manually removing all known input sources and timers from the run loop is not a guarantee that the run loop will exit. Mac OS X can install and remove additional input sources as needed to process requests targeted at the receiver’s thread.
I meant undocumented in the sense that it does not specify the conditions under which it can occur.
For instance, I had a test program which did *nothing* other than create an autorelease pool and run the runloop in the main thread ... but it still blocked. Doing the same thing in a second thread, the loop terminated immediately. Perhaps the main runloop will always block in practice under OSX, but I would not rely on it.
[Prev in Thread] | Current Thread | [Next in Thread] |