• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Run loops and timers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Run loops and timers
      • From: j o a r <email@hidden>
    • Re: Run loops and timers
      • From: Spencer Salazar <email@hidden>
  • Prev by Date: Re: elegant sheet cascade handling?
  • Next by Date: Hanging after autorelease...
  • Previous by thread: Re: Stateful, "Stickies" like behavior for a document-based app
  • Next by thread: Re: Run loops and timers
  • Index(es):
    • Date
    • Thread