diff --git a/reactos/ntoskrnl/include/internal/ke_x.h b/reactos/ntoskrnl/include/internal/ke_x.h index f9762e9128a..8db34413bf9 100644 --- a/reactos/ntoskrnl/include/internal/ke_x.h +++ b/reactos/ntoskrnl/include/internal/ke_x.h @@ -688,6 +688,14 @@ KiReleaseProcessLock(IN PKLOCK_QUEUE_HANDLE Handle) KeReleaseInStackQueuedSpinLock(Handle); } +FORCEINLINE +VOID +KiReleaseProcessLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle) +{ + /* Release the lock */ + KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle); +} + // // This routine queues a thread that is ready on the PRCB's ready lists. // If this thread cannot currently run on this CPU, then the thread is diff --git a/reactos/ntoskrnl/ke/thrdobj.c b/reactos/ntoskrnl/ke/thrdobj.c index b3193c3bfcc..15d94351899 100644 --- a/reactos/ntoskrnl/ke/thrdobj.c +++ b/reactos/ntoskrnl/ke/thrdobj.c @@ -1315,7 +1315,7 @@ KeTerminateThread(IN KPRIORITY Increment) RemoveEntryList(&Thread->ThreadListEntry); /* Release the process lock */ - KiReleaseProcessLock(&LockHandle); + KiReleaseProcessLockFromDpcLevel(&LockHandle); /* Set us as terminated, decrease the Process's stack count */ Thread->State = Terminated; diff --git a/reactos/ntoskrnl/ke/thrdschd.c b/reactos/ntoskrnl/ke/thrdschd.c index 28fb3554adc..9bda109f51f 100644 --- a/reactos/ntoskrnl/ke/thrdschd.c +++ b/reactos/ntoskrnl/ke/thrdschd.c @@ -169,9 +169,9 @@ KiSwapThread(IN PKTHREAD CurrentThread, IN PKPRCB Prcb) { BOOLEAN ApcState; + ASSERT(KeGetCurrentIrql() >= DISPATCH_LEVEL); /* Find a new thread to run */ - DPRINT("Dispatching Thread as blocked\n"); ApcState = KiDispatchThreadNoLock(Waiting); /* Check if we need to deliver APCs */