/*++ Copyright (c) Microsoft Corporation. All rights reserved. You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt). If you do not agree to the terms, do not use the code. Module Name: ki.h Abstract: This module contains the private (internal) header file for the kernel. --*/ FORCEINLINE VOID KxQueueReadyThread ( IN PKTHREAD Thread, IN PKPRCB Prcb ) /*++ Routine Description: This function inserts the previously current thread in the current processor's dispatcher ready queues if the thread can run on the curent processor. Otherwise, the specified thread is readied for execution. N.B. This function is called with the current PRCB lock held and returns with the PRCB lock not held. Arguments: Thread - Supplies a pointer to a thread object. Prcb - Supplies a pointer to a the current PRCB. Return Value: None. --*/ { BOOLEAN Preempted; KPRIORITY Priority; ASSERT(Prcb == KeGetCurrentPrcb()); ASSERT(Thread->State == Running); ASSERT(Thread->NextProcessor == Prcb->Number); // // If the thread can run on the specified processor, then insert the // thread in the appropriate dispatcher ready queue for the specified // processor and release the specified PRCB lock. Otherwise, release // the specified PRCB lock and ready the thread for execution. // #if !defined(NT_UP) if ((Thread->Affinity & Prcb->SetMember) != 0) { #endif Thread->State = Ready; Preempted = Thread->Preempted; Thread->Preempted = FALSE; Thread->WaitTime = KiQueryLowTickCount(); Priority = Thread->Priority; ASSERT((Priority >= 0) && (Priority <= HIGH_PRIORITY)); if (Preempted != FALSE) { InsertHeadList(&Prcb->DispatcherReadyListHead[Priority], &Thread->WaitListEntry); } else { InsertTailList(&Prcb->DispatcherReadyListHead[Priority], &Thread->WaitListEntry); } Prcb->ReadySummary |= PRIORITY_MASK(Priority); ASSERT(Priority == Thread->Priority); KiReleasePrcbLock(Prcb); #if !defined(NT_UP) } else { Thread->State = DeferredReady; Thread->DeferredProcessor = Prcb->Number; KiReleasePrcbLock(Prcb); KiDeferredReadyThread(Thread); } #endif return; }