diff --git a/PowerThreading-Desktop/Wintellect.Threading/ResourceLocks/ResourceLock.cs b/PowerThreading-Desktop/Wintellect.Threading/ResourceLocks/ResourceLock.cs index 62b725b..e235c26 100644 --- a/PowerThreading-Desktop/Wintellect.Threading/ResourceLocks/ResourceLock.cs +++ b/PowerThreading-Desktop/Wintellect.Threading/ResourceLocks/ResourceLock.cs @@ -243,7 +243,6 @@ public void Leave() { #if DEADLOCK_DETECTION if (s_PerformDeadlockDetection) DeadlockDetector.ReleaseLock(this); #endif - OnLeave(exclusive); if (exclusive) { Interlocked.Add(ref m_readWriteCounts, -c_OneWriterCount); //if (AcquiringThreadMustRelease) Thread.EndCriticalRegion(); @@ -251,6 +250,7 @@ public void Leave() { Interlocked.Add(ref m_readWriteCounts, -c_OneReaderCount); // When done reading, there is no need to call EndCriticalRegion since resource was not modified } + OnLeave(exclusive); } #region Helper Methods