Re: Importance of thread safety and performance.
Re: Importance of thread safety and performance.
- Subject: Re: Importance of thread safety and performance.
- From: Andre <email@hidden>
- Date: Sat, 9 Jul 2005 11:15:30 -0700
Hi Pandaa,
The only way to find out if it will be a performance problem is to
write the code and profile it, do not let fear stall your
development! :)
But more importantly, having each and every accessor handle locking
may lead to larger code size and the need to carefully avoid
deadlocks when locking methods call each other or methods which
acquire several locks are called from several threads.
Yea, thats another thing to worry about. Thats gonna cost more time
upfront I would think...
Unless your class is continually accessed from or coordinates work
for many different threads, it will probably be easier to handle
the locking from the outside of the class in objects that logically
take on a coordinating role. This will keep the interactions
between different locks simple, and when performing a series of
primitive operations it will be easy to handle intermediate object
states that should not be exposed to other threads.
Thats another possibility. I had thought about that but forgot, its a
good idea, thanks.
I would rather do things "the right way" first than waste my time
later in upkeep...
That's a good attitude! :) But often there is no "right way" and
even if there is one it may not be easy at all to discover it at
the onset. Wasting time in upkeep may sometimes be the most
efficient way of discovering the right solution.
Yea, thats right too... well, at least I've got some good tips along
the way!
Thanks.
Andre
_______________________________________________
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