[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSTimer
From: |
Richard Frith-Macdonald |
Subject: |
Re: NSTimer |
Date: |
Fri, 27 Feb 2009 06:34:25 +0000 |
On 27 Feb 2009, at 01:58, Scott Christley wrote:
Hello,
I'm using the latest code from SVN. My program is using a repeated
NSTimer much like this sample code, and it no longer seems to be
working. Not sure how long ago it stopped working, I haven't used
my code in many months. The run loop is returning immediately
instead of firing off the message, anybody know what the problem is?
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.
There used to be a bug where the loop would block forever rather than
return immediately, and I guess your code was depending on that.
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
Anyway, the way to do what you want is to use one of the mthods to run
the loop in conjunction with limitDateForMode: and [NSThread-
sleepUntilDate:]
- NSTimer, Scott Christley, 2009/02/26
- Re: NSTimer,
Richard Frith-Macdonald <=