Skip to content

Commit d277936

Browse files
committed
fix WeakDictionary thread-safety
1 parent 31ca2ba commit d277936

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Assets/Plugins/UniRx/Scripts/Async/Internal/WeakDictionary.cs

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public bool TryGetValue(TKey key, out TValue value)
4646
bool lockTaken = false;
4747
try
4848
{
49+
gate.Enter(ref lockTaken);
4950
if (TryGetEntry(key, out _, out var entry))
5051
{
5152
value = entry.Value;
@@ -66,6 +67,7 @@ public bool TryRemove(TKey key)
6667
bool lockTaken = false;
6768
try
6869
{
70+
gate.Enter(ref lockTaken);
6971
if (TryGetEntry(key, out var hashIndex, out var entry))
7072
{
7173
Remove(hashIndex, entry);

0 commit comments

Comments
 (0)