Change SPIN_LOCK_ACQUIRED to 1 and SPIN_LOCK_RELEASED to 2 according to MWG.
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 29 May 2006 02:34:09 +0000 (02:34 +0000)
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 29 May 2006 02:34:09 +0000 (02:34 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@310 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseLib/Synchronization.c

index df39586..c04edfc 100644 (file)
@@ -14,8 +14,8 @@
 \r
 **/\r
 \r
-#define SPIN_LOCK_RELEASED          ((SPIN_LOCK)0)\r
-#define SPIN_LOCK_ACQUIRED          ((SPIN_LOCK)-1)\r
+#define SPIN_LOCK_RELEASED          ((SPIN_LOCK)1)\r
+#define SPIN_LOCK_ACQUIRED          ((SPIN_LOCK)2)\r
 \r
 UINT32\r
 EFIAPI\r
@@ -94,7 +94,7 @@ InitializeSpinLock (
   )\r
 {\r
   ASSERT (SpinLock != NULL);\r
-  *SpinLock = 0;\r
+  *SpinLock = SPIN_LOCK_RELEASED;\r
   return SpinLock;\r
 }\r
 \r
@@ -178,6 +178,7 @@ AcquireSpinLockOrFail (
   )\r
 {\r
   ASSERT (SpinLock != NULL);\r
+  ASSERT (*SpinLock == SPIN_LOCK_ACQUIRED || *SpinLock == SPIN_LOCK_RELEASED);\r
   return (BOOLEAN)(\r
            InterlockedCompareExchangePointer (\r
              (VOID**)SpinLock,\r
@@ -208,7 +209,8 @@ ReleaseSpinLock (
   )\r
 {\r
   ASSERT (SpinLock != NULL);\r
-  *SpinLock = 0;\r
+  ASSERT (*SpinLock == SPIN_LOCK_ACQUIRED || *SpinLock == SPIN_LOCK_RELEASED);\r
+  *SpinLock = SPIN_LOCK_RELEASED;\r
   return SpinLock;\r
 }\r
 \r