The documentation of ConcurrentDictionary
doesn't explicit state, so I guess we cannot expect that delegates valueFactory
and updateValueFactory
have their execution synchronized (from GetOrAdd() and AddOrUpdate() operations respectively).
So, I think we cannot implement use of resources inside them which need concurrent control without manually implementing our own concurrent control, maybe just using [MethodImpl(MethodImplOptions.Synchronized)]
over the delegates.
Am I right? Or the fact that ConcurrentDictionary
is thread-safe we can expect that calls to these delegates are automatically synchronized (thread-safe too)?