• 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: Threadsafe copy of objective c object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threadsafe copy of objective c object


  • Subject: Re: Threadsafe copy of objective c object
  • From: Kyle Sluder <email@hidden>
  • Date: Tue, 03 Sep 2013 10:26:25 -0700

On Tue, Sep 3, 2013, at 07:29 AM, David Duncan wrote:
> On Sep 3, 2013, at 5:39 AM, Jonathan Taylor
> <email@hidden> wrote:
>
> > I would like to be able to take a copy of MyParameters from a thread that is not the main thread
>
> Why?
>
> Sure, you have a thread doing real-time video processing, but how
> expensive can it be to make a copy and send it over? Audio Units
> basically do this and they are just as real-time.

One of the cardinal rules of Audio Units is "Thou Shalt Not Allocate
Memory On The Render Callback Thread."

malloc takes a lock. Taking a lock is a great way to make you thread
miss its hard-realtime constraint, which leads to glitching and
potentially getting killed by the host.

The typical way to do this is to perform your allocations and copies on
a NON-realtime thread, and transfer ownership of data to your render
thread via a lockless data structure such as a ring buffer. Your
realtime thread runs for very brief periods, consuming one or two chunks
of data, while your non-realtime thread runs more sporadically but for
much longer periods of time, hopefully often enough to keep up with the
realtime thread's consumption of data.

--Kyle Sluder
_______________________________________________

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: 
 >Threadsafe copy of objective c object (From: Jonathan Taylor <email@hidden>)
 >Re: Threadsafe copy of objective c object (From: Graham Cox <email@hidden>)
 >Re: Threadsafe copy of objective c object (From: Lasse Jansen <email@hidden>)
 >Re: Threadsafe copy of objective c object (From: Diederik Meijer | Ten Horses <email@hidden>)
 >Re: Threadsafe copy of objective c object (From: Jonathan Taylor <email@hidden>)
 >Re: Threadsafe copy of objective c object (From: David Duncan <email@hidden>)

  • Prev by Date: Re: NSPanel doesn't reposition correctly after screen resize
  • Next by Date: Re: NSPanel doesn't reposition correctly after screen resize
  • Previous by thread: Re: Threadsafe copy of objective c object
  • Next by thread: Re: Threadsafe copy of objective c object
  • Index(es):
    • Date
    • Thread