Re: Run loops and timers
Re: Run loops and timers
- Subject: Re: Run loops and timers
- From: Spencer Salazar <email@hidden>
- Date: Tue, 10 Apr 2007 14:34:57 -0400
How about using a custom (version 0) CFRunLoopSource with the
NSRunLoop's underlying CFRunLoop? That should be thread-safe and is
pretty light-weight.
spencer
On Apr 10, 2007, at 2:00 PM, John Stiles wrote:
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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