Re: Locking Question around hashtable

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:1139836296.856759.110660@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nick Hounsome wrote:
If you've just got a single writer and multiple readers, the
documentation states that you don't need any locking.

Which documentation?

QUOTE
Thread Safety
To support one or more writers, all operations on the Hashtable must be
done
through the wrapper returned by the Synchronized method.
UNQUOTE

Good question. I *know* that the documentation did at one stage say
that it was safe for a single writer and multiple readers - but I can't
find it now :(

(I seem to remember that at the time that it said it was safe in that
way, the Thread Safety section itself was the standard "instance
members aren't threadsafe" docs, so it was already self-contradictory.)

You should be OK(ish) provided that you don't add or remove items.
Reading or changing (h[a]=b) should probably be alright but things would go
horribly wrong if a bucket was added or an element chained whilst a read was
in progress without some locking


.



Relevant Pages

  • Re: Locking Question around hashtable
    ... documentation states that you don't need any locking. ... To support one or more writers, all operations on the Hashtable must be done ... that it was safe for a single writer and multiple readers - but I can't ... the Thread Safety section itself was the standard "instance ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Suggestion for review: a taxonomy of thread safety
    ... >>is not, in my opinion, to be considered threaded ... Well, it cannot multiprocess ... > I agree that locking and unlocking of values and of objects is not ... > documentation. ...
    (comp.programming)
  • Re: No wonder Borland Technical Documentation stinks
    ... DevCo can vette books for a DevCo Press ... Or make it a joint responsibility of documentation and ... writers and R&D team, so the writers become a part of the scrum. ... unit and integration test code into the product's documentation. ...
    (borland.public.delphi.non-technical)
  • Re: Thread safety documentation
    ... the lack of consistent documentation and default rules for thread safety. ... If it's simply a matter of documentation, it seems to me that JCIP made a good start with Appendix A, Annotations for Concurrency. ... I should add that I suggested these annotations be added to the core language, like @Override is, and they rejected it because they felt these annotations should be part of the Java doc controls and an API issue rather thanu a language feature. ...
    (comp.lang.java.programmer)
  • Re: File/record locking
    ... I'd ask in one of the access newsgroups for the location of ... locking to handle multi-user concurrency issues. ... If you can refer me to any documentation and samples, ...
    (microsoft.public.data.oledb)