• 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: Importance of thread safety and performance.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importance of thread safety and performance.


  • Subject: Re: Importance of thread safety and performance.
  • From: Jonathon Mah <email@hidden>
  • Date: Sat, 9 Jul 2005 23:51:35 +0930

On 2005-07-09, at 14:57, アンドレ(Andre) wrote:

Ok, my first idea is to just make every accessor setter and methods that alter data use NSLock to lock and unlock
any changed variables etc... My concern here is say [myObject addObject:object] was called a large number of times,
all of the locking and unlocking would slow things down wouldn't it?

How many times? Locking should be absolutely negligible.

Another idea is to make two methods like -threadSafeAddObject and - addObject...

A possibly better alternative would be to have a method -[myObject addObjectsFromArray:someArray], which will only need to lock one lock, add everything, and then unlock it.



Jonathon Mah email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Importance of thread safety and performance.
      • From: アンドレ(Andre) <email@hidden>
    • Re: Importance of thread safety and performance.
      • From: Pandaa <email@hidden>
References: 
 >Importance of thread safety and performance. (From: アンドレ(Andre) <email@hidden>)

  • Prev by Date: detecting scroll event in webView
  • Next by Date: Re: NSCombobox subclass and binding ?
  • Previous by thread: Importance of thread safety and performance.
  • Next by thread: Re: Importance of thread safety and performance.
  • Index(es):
    • Date
    • Thread