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

Threadsafe copy of objective c object


  • Subject: Threadsafe copy of objective c object
  • From: Jonathan Taylor <email@hidden>
  • Date: Tue, 03 Sep 2013 11:52:07 +0100

This feels like it should be a very basic question, but it's not one I've managed to find an answer to - can somebody here advise?

I have an objective c object which contains a number of properties that serve as parameters for an algorithm. They are bound to UI elements. I would like to take a snapshot copy of the object that will be used for one whole run of the algorithm (rather than risk parameters changing halfway through the run). i.e. I just want to do [myObject copy].

The complication is in ensuring this is threadsafe: ideally I would like to make the copy on a thread other than the main thread. My understanding is that properties themselves, even when designated atomic, are in some way not fully threadsafe, although I haven't found a clear explanation of exactly what makes them unsafe. I don't know if the 'copy' method is threadsafe or not, I am inclined to suspect not.

Is there any way, then, that I can take a copy in a threadsafe manner? If necessary I can do the copy on the main thread, but I would prefer not to have to do that for timing reasons. Any suggestions?

Cheers
Jonny.
_______________________________________________

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: Marcel Weiher <email@hidden>
    • Re: Threadsafe copy of objective c object
      • From: Dave <email@hidden>
    • Re: Threadsafe copy of objective c object
      • From: Dave <email@hidden>
    • Re: Threadsafe copy of objective c object
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: bugreport.apple.com
  • Next by Date: Re: Threadsafe copy of objective c object
  • Previous by thread: Re: bugreport.apple.com
  • Next by thread: Re: Threadsafe copy of objective c object
  • Index(es):
    • Date
    • Thread