I am confused about the AddOrUpdate method. The document specifically says that the updateValueFactory is not synchronized.
In the MSDN this example was given:
Parallel.For(0, 10000, i =>
{
// Initial call will set cd[1] = 1.
// Ensuing calls will set cd[1] = cd[1] + 1
cd.AddOrUpdate(1, 1, (key, oldValue) => oldValue + 1);
});
If there are multiple threads trying increment the oldvalue, isn't it possible some of them will be updating a stale value instead?
Thanks.