Run loops and timers
Run loops and timers
- Subject: Run loops and timers
- From: John Stiles <email@hidden>
- Date: Tue, 10 Apr 2007 11:00:34 -0700
I'd like to make a secondary thread which is in charge of running its
own run loop and receiving callbacks on the run loop (e.g. from a
NSURLConnection or other APIs which do callbacks onto the run loop).
It seems easy to split off a new thread and make a run loop, but how
do I wake up that thread and tell it to do something (e.g. actually
start a download via +NSURLConnection
connectionWithRequest:delegate:)? It seems like NSTimer would be
perfect, but the NSRunLoop docs warn that it isn't thread safe, so it
seems like I can't create an NSTimer object on my main thread and
then add it to the NSRunLoop of my secondary thread.
Maybe Distributed Objects is the way to go here but that seems like a
pretty heavyweight solution for what should be a lightweight problem.
So what is the best way of going about this?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden