Skip to content

Commit

Permalink
Merge pull request #484 from tangdf/Shorten_lock_time
Browse files Browse the repository at this point in the history
Shorten lock time
  • Loading branch information
jonorossi committed Apr 2, 2020
2 parents e2dfb57 + c110d93 commit 0efb1ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Castle.Core/Core/Internal/SynchronizedDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ public TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
}
else
{
value = valueFactory.Invoke(key);

itemsLock.EnterWriteLock();
try
{
value = valueFactory.Invoke(key);
items.Add(key, value);
return value;
}
Expand Down

0 comments on commit 0efb1ef

Please sign in to comment.