• 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: Graham Cox <email@hidden>
  • Date: Tue, 03 Sep 2013 13:04:13 +0200

On 03/09/2013, at 12:52 PM, Jonathan Taylor <email@hidden> wrote:

> 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?

Since the implementation of -copy is up to you, you could just put @synchronized(self){…..} around the code in that method. That implements a lock which should make the copy thread-safe.

--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: Threadsafe copy of objective c object
      • From: Lasse Jansen <email@hidden>
    • Re: Threadsafe copy of objective c object
      • From: Jonathan Taylor <email@hidden>
References: 
 >Threadsafe copy of objective c object (From: Jonathan Taylor <email@hidden>)

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