From 277872438cb6f52662ee093a1385a6a6556e7c53 Mon Sep 17 00:00:00 2001 From: bxing Date: Mon, 29 May 2006 02:34:09 +0000 Subject: 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 --- MdePkg/Library/BaseLib/Synchronization.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'MdePkg') 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; } -- cgit v1.2.3