summaryrefslogtreecommitdiff
path: root/src/vm/synch.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/synch.h')
-rw-r--r--src/vm/synch.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vm/synch.h b/src/vm/synch.h
index 30e6c30672..1da2107b8d 100644
--- a/src/vm/synch.h
+++ b/src/vm/synch.h
@@ -219,6 +219,12 @@ private:
return *this;
}
+ Counts VolatileLoadWithoutBarrier() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ::VolatileLoadWithoutBarrier(&data);
+ }
+
Counts CompareExchange(Counts toCounts, Counts fromCounts)
{
LIMITED_METHOD_CONTRACT;
@@ -264,7 +270,11 @@ public:
private:
BYTE __padding1[MAX_CACHE_LINE_SIZE]; // padding to ensure that m_counts gets its own cache line
+
+ // Take care to use 'm_counts.VolatileLoadWithoutBarrier()` when loading this value into a local variable that will be
+ // reused. See AwareLock::m_lockState for details.
Counts m_counts;
+
BYTE __padding2[MAX_CACHE_LINE_SIZE]; // padding to ensure that m_counts gets its own cache line
#if defined(DEBUG)