discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer


From: David Chisnall
Subject: Re: NSTimer
Date: Fri, 27 Feb 2009 11:15:21 +0000

On 27 Feb 2009, at 06:34, Richard Frith-Macdonald wrote:

You need to have some input source in the run loop (a timer doesn't count) or it will return immediately, as specified in the Apple docs.


The docs say:

If no input sources or timers are attached to the run loop, this method exits immediately

Timers are not considered input sources according to this comment in the docs:

A timer is not considered an input source and may fire multiple times while waiting for this method to return


A runloop will not exit immediately if there are timers but not input sources connected, but methods that wait for one event from an input source may fire the timer more than once.

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 loop

This 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.



David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]