> Helpfully, this is contradicted by the main documentation for the class
> itself:
>
> " To support one or more writers, all operations on the Hashtable must
> be done through the wrapper returned by the Synchronized method."
>
> This suggests that synchronization is always required for multithreaded
> operation, except for the special case where you initialize your
> hashtable during initialization, and thereafter use it from multiple
> threads that only ever read from it.
>
> I'm not sure which of those two is actually true...

In my experience, the latter is true. We would consistently get errors when
multiple threads attempted to write from multiple threads and have not had any
problems when syncronizing. In that case the problem was that one thread would
add something while another checked to see if it existed and added if necesary.
That's exactly what happens if your code is

myHash[key] = value;

if key is not in the hash, it is added automatically, otherwise the value is
just assigned.

=====
Philip - http://blogs.xcskiwinn.org/panmanphil
"There's a difference between righteous anger and just being crabby" - Barbara

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to