summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseLib/SynchronizationMsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BaseLib/SynchronizationMsc.c')
-rw-r--r--MdePkg/Library/BaseLib/SynchronizationMsc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/MdePkg/Library/BaseLib/SynchronizationMsc.c b/MdePkg/Library/BaseLib/SynchronizationMsc.c
index fb10b5d01b..ce330aed88 100644
--- a/MdePkg/Library/BaseLib/SynchronizationMsc.c
+++ b/MdePkg/Library/BaseLib/SynchronizationMsc.c
@@ -162,10 +162,13 @@ AcquireSpinLockOrFail (
IN OUT SPIN_LOCK *SpinLock
)
{
- VOID *Result;
+ SPIN_LOCK LockValue;
+ VOID *Result;
ASSERT (SpinLock != NULL);
- ASSERT (*SpinLock == SPIN_LOCK_ACQUIRED || *SpinLock == SPIN_LOCK_RELEASED);
+
+ LockValue = *SpinLock;
+ ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
_ReadWriteBarrier ();
Result = InterlockedCompareExchangePointer (
@@ -198,8 +201,12 @@ ReleaseSpinLock (
IN OUT SPIN_LOCK *SpinLock
)
{
+ SPIN_LOCK LockValue;
+
ASSERT (SpinLock != NULL);
- ASSERT (*SpinLock == SPIN_LOCK_ACQUIRED || *SpinLock == SPIN_LOCK_RELEASED);
+
+ LockValue = *SpinLock;
+ ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
_ReadWriteBarrier ();
*SpinLock = SPIN_LOCK_RELEASED;