Implement deferred ready thread insertion
All checks were successful
Builds / ExectOS (i686, debug) (push) Successful in 34s
Builds / ExectOS (amd64, debug) (push) Successful in 36s
Builds / ExectOS (i686, release) (push) Successful in 39s
Builds / ExectOS (amd64, release) (push) Successful in 42s

This commit is contained in:
2026-06-17 16:13:02 +02:00
parent cea860b008
commit ea1ad3c6b1
4 changed files with 64 additions and 0 deletions

37
xtoskrnl/ke/schedule.cc Normal file
View File

@@ -0,0 +1,37 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtoskrnl/ke/schedule.cc
* DESCRIPTION: XT Kernel Thread Scheduler
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
*/
#include <xtos.hh>
/**
* Inserts a thread into the current processor's deferred ready list.
*
* @param Thread
* Supplies a pointer to the thread being deferred.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTFASTCALL
VOID
KE::Scheduler::InsertDeferredReadyList(IN PKTHREAD Thread)
{
PKPROCESSOR_CONTROL_BLOCK Prcb;
/* Retrieve the Processor Control Block (PRCB) for the executing core */
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
/* Tag the thread with the current CPU and update its scheduling state */
Thread->DeferredProcessor = Prcb->CpuNumber;
Thread->State = DeferredReady;
/* Insert the thread into the deferred ready list */
RTL::LifoQueue::PushEntryList(&Prcb->DeferredReadyListHead, &Thread->SwapListEntry);
}