summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-05-29 02:34:09 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-05-29 02:34:09 +0000
commit277872438cb6f52662ee093a1385a6a6556e7c53 (patch)
tree376e9814e1287c7ecf145273358a753f108777a1 /MdePkg
parent4c114006de95489973d33a5415bb451bcd6cd62a (diff)
downloadedk2-platforms-277872438cb6f52662ee093a1385a6a6556e7c53.tar.xz
Change SPIN_LOCK_ACQUIRED to 1 and SPIN_LOCK_RELEASED to 2 according to MWG.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@310 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseLib/Synchronization.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/MdePkg/Library/BaseLib/Synchronization.c b/MdePkg/Library/BaseLib/Synchronization.c
index df395869a2..c04edfc251 100644
--- a/MdePkg/Library/BaseLib/Synchronization.c
+++ b/MdePkg/Library/BaseLib/Synchronization.c
@@ -14,8 +14,8 @@
**/
-#define SPIN_LOCK_RELEASED ((SPIN_LOCK)0)
-#define SPIN_LOCK_ACQUIRED ((SPIN_LOCK)-1)
+#define SPIN_LOCK_RELEASED ((SPIN_LOCK)1)
+#define SPIN_LOCK_ACQUIRED ((SPIN_LOCK)2)
UINT32
EFIAPI
@@ -94,7 +94,7 @@ InitializeSpinLock (
)
{
ASSERT (SpinLock != NULL);
- *SpinLock = 0;
+ *SpinLock = SPIN_LOCK_RELEASED;
return SpinLock;
}
@@ -178,6 +178,7 @@ AcquireSpinLockOrFail (
)
{
ASSERT (SpinLock != NULL);
+ ASSERT (*SpinLock == SPIN_LOCK_ACQUIRED || *SpinLock == SPIN_LOCK_RELEASED);
return (BOOLEAN)(
InterlockedCompareExchangePointer (
(VOID**)SpinLock,
@@ -208,7 +209,8 @@ ReleaseSpinLock (
)
{
ASSERT (SpinLock != NULL);
- *SpinLock = 0;
+ ASSERT (*SpinLock == SPIN_LOCK_ACQUIRED || *SpinLock == SPIN_LOCK_RELEASED);
+ *SpinLock = SPIN_LOCK_RELEASED;
return SpinLock;
}