• 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: Jonathan Taylor <email@hidden>
  • Date: Tue, 03 Sep 2013 14:34:20 +0100

Ah. In my original email I didn't explain *why* it is that "ideally I would like to make the copy on a thread other than the main thread". The algorithm is doing real-time video processing, and I very much want to avoid holding up anything in that code path by synchronizing with the main queue. Past experience has shown that that does lead to glitches I am keen to avoid. So, while I'm a big fan of such constructions, I'm deliberately trying to avoid that here.

Serializing access to MyParameters will work, it's just a shame that there isn't such a tidy way of achieving that...


On 3 Sep 2013, at 14:18, Robert Vojta wrote:

> Then this should be enough ...
>
> - (MyParameters *)copyParameters {
>     __block MyParameters *parameters;
>     dispatch_sync( dispatch_get_main_queue(), ^{
>         parameters = [myObjectHoldingParameters.parameters copy];
>     });
>     return parameters;
> }
>
> ... if all your parameters object properties are set on the main thread only.
>


_______________________________________________

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: Threadsafe copy of objective c object
      • From: Jeff Kelley <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: Robert Vojta <email@hidden>)
 >Re: Threadsafe copy of objective c object (From: Jonathan Taylor <email@hidden>)
 >Re: Threadsafe copy of objective c object (From: Robert Vojta <email@hidden>)

  • Prev by Date: Re: Threadsafe copy of objective c object
  • Next by Date: Re: Threadsafe copy of objective c object
  • Previous by thread: Re: Threadsafe copy of objective c object
  • Next by thread: Re: Threadsafe copy of objective c object
  • Index(es):
    • Date
    • Thread