Re[4]: clr perf problem
От: mapnik США http://www.hooli.xyz/
Дата: 30.06.15 09:26
Оценка:
Здравствуйте, Ночной Смотрящий, Вы писали:

НС>Кто тебе такой бред сказал? И то и другое — не thread safe. Оба поддерживают режим произвольного количества читателей. Наконец, есть действительно thread safe словарь — ConcurrentDictionary.


Вы документацию производителя вообще читаете? Впрочем зачем это шарепоинт-программистам, это же не модно — читать.

Hashtable is thread safe for use by multiple reader threads and a single writing thread. It is thread safe for multi-thread use when only one of the threads perform write (update) operations, which allows for lock-free reads provided that the writers are serialized to the Hashtable.


A Dictionary can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. In the rare case where an enumeration contends with write accesses, the collection must be locked during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.


И нет я не могу использовать ConcurrentDictionary — мне нужно поддерживать версии .net < 4.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.