MSDN points out that mutating access to the .NET Dictionary<K,V> type is not thread safe. Is there a standard thread safe version?
Note: “No there is not” is a valid answer if it is true. In that cases (and it seem to be) I’ll go off and do the lock thing.
Almost Duplicate
What’s the best way of implementing a thread-safe Dictionary in .NET? (Not exact because I want a standard type, not something I implement my self)
There isn’t. Consider this code, where each method/property was thread safe
athough each action could be threadsafe, the block of code has a race condition, b/c there are two method calls and two different critical sections. The only way to do it is by hand