diff --git a/ntoskrnl/ke/thrdschd.c b/ntoskrnl/ke/thrdschd.c index fbc56277c95..10dc41488c3 100644 --- a/ntoskrnl/ke/thrdschd.c +++ b/ntoskrnl/ke/thrdschd.c @@ -328,6 +328,7 @@ KiDeferredReadyThread(IN PKTHREAD Thread) { /* Sanity check */ ASSERT(NextThread->State == Standby); + ASSERT(NextThread != KeGetCurrentThread()); /* Check if priority changed */ if (OldPriority > NextThread->Priority) @@ -358,6 +359,7 @@ KiDeferredReadyThread(IN PKTHREAD Thread) /* Set the thread on standby and as the next thread */ Thread->State = Standby; + ASSERT(Prcb->NextThread != Thread); Prcb->NextThread = Thread; /* Release the lock */ @@ -441,6 +443,9 @@ KiSwapThread(IN PKTHREAD CurrentThread, NextThread = Prcb->NextThread; if (NextThread) { + ASSERT(NextThread->State == Standby); + ASSERT(NextThread != CurrentThread); + /* Already got a thread, set it up */ Prcb->NextThread = NULL; Prcb->CurrentThread = NextThread; @@ -452,6 +457,10 @@ KiSwapThread(IN PKTHREAD CurrentThread, NextThread = KiSelectReadyThread(0, Prcb); if (NextThread) { +#ifndef CONFIG_SMP + ASSERT(NextThread != CurrentThread); +#endif + /* Switch to it */ Prcb->CurrentThread = NextThread; NextThread->State = Running; @@ -463,6 +472,7 @@ KiSwapThread(IN PKTHREAD CurrentThread, /* Schedule the idle thread */ NextThread = Prcb->IdleThread; + ASSERT(NextThread != CurrentThread); Prcb->CurrentThread = NextThread; NextThread->State = Running; }