Just a minor correction:

All threads have a run loop created automatically, but only the main thread's 
run loop is running by default (if it's a GUI application).  If you're on a 
secondary thread, you have to spin the run loop manually using one of its 
"run..." methods.

But (in essence) you're correct that the run loop of the secondary thread is 
not running, which means it's not processing timer events.

Dave

On Sep 2, 2010, at 8:48 PM, Nathan Day wrote:

> NSTimers rely on there being an NSRunLoop for the current thread, so if you 
> are creating a timer in a thread without a run loop it will not work, because 
> the is no run loop to add the timer to. From the sounds of it you also want 
> the timer to be executed in the main thread, in which case you will have to 
> use one of the perform in main thread methods so the creation of you timer 
> can happen in the main thread. You may alternatively be able to create a time 
> and manually add it to the main runloop if the methods for that are thread 
> safe, but I don't think they are. 
> 
> Sent from my iPad

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to