private static void Exit(ref SpinLockInstance lockVar)
 {
     if (lockVar.isLocked == 1)
     {
         Interlocked.Exchange(ref lockVar.isLocked, 0);
     }
 }
        private static void Enter(ref SpinLockInstance lockVar, ref bool locked)
        {
            locked = false;

            while (1 == Interlocked.Exchange(ref lockVar.isLocked, 1))
            {
            }

            locked = true;
        }
 private static void SetBusy(ref SpinLockInstance lockVar)
 {
     Interlocked.Exchange(ref lockVar.isLocked, 1);
 }