summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-01-23 06:45:41 -0800
committerJan Kotas <jkotas@microsoft.com>2016-01-23 06:45:41 -0800
commit8f66908908150a7719ec323a29214ae823bfc70a (patch)
tree07f819b1117d11c0bedbd583bf47f70831834297 /src
parent49f39af14e6e2d4048f3c74db0c5164c0f4131b5 (diff)
parent952fdd33c45f053c21142f008716521328477efb (diff)
downloadcoreclr-8f66908908150a7719ec323a29214ae823bfc70a.tar.gz
coreclr-8f66908908150a7719ec323a29214ae823bfc70a.tar.bz2
coreclr-8f66908908150a7719ec323a29214ae823bfc70a.zip
Merge pull request #2795 from Dmitry-Me/fixInterlockedDecrementRace
Non-interlocked read of variable after InterlockedDecrement() causes a race
Diffstat (limited to 'src')
-rw-r--r--src/debug/di/rspriv.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/debug/di/rspriv.h b/src/debug/di/rspriv.h
index a89b17d49b..7238ffd787 100644
--- a/src/debug/di/rspriv.h
+++ b/src/debug/di/rspriv.h
@@ -1266,14 +1266,14 @@ public:
LOG((LF_CORDB, LL_EVERYTHING, "Memory: CordbBase object deleted: this=%p, id=%p, Refcount=0x%x\n", this, m_id, m_RefCount));
#ifdef _DEBUG
- InterlockedDecrement(&s_TotalObjectCount);
- _ASSERTE(s_TotalObjectCount >= 0);
+ LONG newTotalObjectsCount = InterlockedDecrement(&s_TotalObjectCount);
+ _ASSERTE(newTotalObjectsCount >= 0);
#endif
// Don't shutdown logic until everybody is done with it.
// If we leak objects, this may mean that we never shutdown logging at all!
#if defined(_DEBUG) && defined(LOGGING)
- if (s_TotalObjectCount == 0)
+ if (newTotalObjectsCount == 0)
{
ShutdownLogging();
}