Make sure compiler doesn't optimize our wait loop away. Patch by Thomas Weidenmueller
[reactos.git] / reactos / ntoskrnl / ke / spinlock.c
index a4f969d..a5ec502 100644 (file)
@@ -151,7 +151,7 @@ KiAcquireSpinLock(PKSPIN_LOCK SpinLock)
         if (InterlockedBitTestAndSet((PLONG)SpinLock, 0))
         {
             /* Value changed... wait until it's locked */
-            while (*SpinLock == 1) YieldProcessor();
+            while (*(volatile KSPIN_LOCK *)SpinLock == 1) YieldProcessor();
         }
         else
         {