This commit is contained in:
xli24 2006-11-13 03:40:52 +00:00
parent d73991a143
commit c9708dddc1
1 changed files with 12 additions and 2 deletions

View File

@ -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;
}