• 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
Inserting a task into the run loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inserting a task into the run loop


  • Subject: Inserting a task into the run loop
  • From: Graham Cox <email@hidden>
  • Date: Sun, 22 Mar 2015 15:27:07 +1100

I have a requirement that runs my code exactly once per run loop, and I'm wondering what the modern preferred way to do this is.

I've developed the code using a timer with a very fast rate which I know can't really be met, so effectively it's calling back once per loop, but I figure there has to be a supported way to do that.

Is using -[NSRunLoop addPort:forMode:] the way to do this, or would using an NSOperation on the main queue be better? Since my code loops continuously, creating a separate new task each turn of the loop seem inefficient - better if there's something I can create once and it is called once per loop until I tell it to stop.

I've never had call to do this before, so I'm not sure what I should be doing here.

--Graham



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Inserting a task into the run loop
      • From: Uli Kusterer <email@hidden>
    • Re: Inserting a task into the run loop
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Why is NSString.UTF8String unavailable in Swift?
  • Next by Date: Re: Inserting a task into the run loop
  • Previous by thread: Re: Why is NSString.UTF8String unavailable in Swift?
  • Next by thread: Re: Inserting a task into the run loop
  • Index(es):
    • Date
    • Thread