Re: NSTimer in a secondary thread?
Re: NSTimer in a secondary thread?
- Subject: Re: NSTimer in a secondary thread?
- From: Chris Kane <email@hidden>
- Date: Wed, 21 Aug 2002 18:02:46 -0700
On Wednesday, August 21, 2002, at 03:25 PM, Pierre-Olivier Latour wrote:
Sure, that's why I call:
runLoop = [NSRunLoop currentRunLoop];
According to the doc, [NSRunLoop currentRunLoop] will create a run
loop
if
there's none in the thread.
I'm being really dozy today.
Anyway, yes, it will create one, but as Aram noted you're not telling
it
to actually *run*. :-)
I remember trying [[NSRunLoop currentRunLoop] run] but it didn't change
anything. Actually, according the NSLogs outputs, this call was
blocking
earlier, so it didn't even reach the [run] method:
[runLoop addTimer:[timer retain] forMode:[runLoop currentMode]];
-currentMode returns nil if the run loop isn't running, so that's the
problem. -currentMode is pretty much only useful, in rare cases, for
debugging.
Use NSDefaultRunLoopMode as the mode parameter instead.
Chris Kane
Cocoa Frameworks
_______________________________________________
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.