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

Re: Inserting a task into the run loop


  • Subject: Re: Inserting a task into the run loop
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 23 Mar 2015 01:42:13 +0000

On Mar 22, 2015, at 16:28 , Graham Cox <email@hidden> wrote:
>
> Each cycle of the loop it looks at whether any state of any "device" has changed and propagates the change.

What I don’t understand is what this has got to do with run loops at all. You want to poll some state often, I suppose you can do it with run loops, but seems clunky if you have to *force* the run loop to cycle often.

The thing that comes to mind as an alternative is CVDisplayLink. It’s effectively a low-overhead timer that runs at the display update rate (generally 60 fps, synchronized with display updates, as a matter of fact). I understand that in the case the rate isn’t important — though you don’t need anything higher than that, because you can’t update the UI at a faster rate anyway, when something changes in your simulation — but it’s probably high enough.

Of course, you’d need to keep the processing in your display link callback to a minimum, and anything that triggers a lot of work or needs to update the UI will need to be packaged into a block that’s shunted off to a background thread or the main thread. But it’s a fairly simple way to do high-frequency polling that’s responsive but not real-time-critical.



_______________________________________________

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


References: 
 >Inserting a task into the run loop (From: Graham Cox <email@hidden>)
 >Re: Inserting a task into the run loop (From: Kyle Sluder <email@hidden>)
 >Re: Inserting a task into the run loop (From: Graham Cox <email@hidden>)
 >Re: Inserting a task into the run loop (From: Ken Thomases <email@hidden>)
 >Re: Inserting a task into the run loop (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Inserting a task into the run loop
  • Next by Date: Re: Inserting a task into the run loop
  • Previous by thread: Re: Inserting a task into the run loop
  • Next by thread: Re: Inserting a task into the run loop
  • Index(es):
    • Date
    • Thread