Re: Importance of thread safety and performance.
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