/* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with  */
BOOLEAN EFIAPI AcquireSpinLockOrFail(IN OUT SPIN_LOCK *SpinLock)
/* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with  */
BOOLEAN EFIAPI AcquireSpinLockOrFail(IN OUT SPIN_LOCK *SpinLock)
{
  SPIN_LOCK  LockValue;
  ASSERT (SpinLock != NULL);
  LockValue = *SpinLock;
  ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue);
  return (BOOLEAN)(
                   InterlockedCompareExchangePointer (
                     (VOID **)SpinLock,
                     (VOID *)SPIN_LOCK_RELEASED,
                     (VOID *)SPIN_LOCK_ACQUIRED
                     ) == (VOID *)SPIN_LOCK_RELEASED
                   );
}