diff options
-rw-r--r-- | MdePkg/Library/BaseLib/Synchronization.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/MdePkg/Library/BaseLib/Synchronization.c b/MdePkg/Library/BaseLib/Synchronization.c index cf001ce4d1..5033133224 100644 --- a/MdePkg/Library/BaseLib/Synchronization.c +++ b/MdePkg/Library/BaseLib/Synchronization.c @@ -236,8 +236,13 @@ AcquireSpinLockOrFail ( 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);
+
return (BOOLEAN)(
InterlockedCompareExchangePointer (
(VOID**)SpinLock,
@@ -267,8 +272,13 @@ 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);
+
*SpinLock = SPIN_LOCK_RELEASED;
return SpinLock;
}
|