Skip to content

Commit 9e2997e

Browse files
committed
Fixed regression
1 parent d1c508f commit 9e2997e

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/DotNext.Tests/Threading/AsyncExclusiveLockTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,8 @@ public static void ReentrantLock()
236236
False(l.TryAcquire());
237237

238238
Throws<LockRecursionException>(() => l.TryAcquire(DefaultTimeout));
239+
240+
l.Release();
241+
True(l.TryAcquire(DefaultTimeout));
239242
}
240243
}

src/DotNext.Tests/Threading/AsyncReaderWriterLockTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,5 +263,8 @@ public static void ReentrantLock()
263263

264264
Throws<LockRecursionException>(() => l.TryEnterReadLock(DefaultTimeout));
265265
Throws<LockRecursionException>(() => l.TryEnterWriteLock(DefaultTimeout));
266+
267+
l.Release();
268+
True(l.TryEnterReadLock(DefaultTimeout));
266269
}
267270
}

src/DotNext.Threading/Threading/AsyncReaderWriterLock.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ public void Release()
645645
throw new SynchronizationLockException(ExceptionMessages.NotInLock);
646646

647647
state.ExitLock();
648+
IsLockHelpByCurrentThread = false;
648649
suspendedCallers = DrainWaitQueue();
649650

650651
if (IsDisposing && IsReadyToDispose)

0 commit comments

Comments
 (0)