0
나는 그런 ConcurrentDictionary<K, V>
같이 System.Collection.Concurrent
네임 스페이스에서 컬렉션을 사용하고, 나는 내 액세스 및 수정을 인터리빙에서이 개체의 다른 스레드 액세스 및 수정을 유지하려는 경우.System.Collections.Concurrent 개체에서 여러 작업을 기본적으로 수행합니까?
어떻게하면됩니까? 가능한 경우, 경합하는 스레드가 이러한 작업을 수행 할 때 ConcurrentDictionary
에 액세스하려고하면 매우 느리게 끝나지 않습니까?
ConcurrentDictionary<KType, VType> conDict = ...;
// How do I ensure that these operation are performed atomically?
VType myVInst;
conDict.TryRemove(2, out myVInst);
conDict.AddOrUpdate(1, new VType(), (x, y) => y);