The scheduler now keeps track of the initial process.

This commit is contained in:
Jonas 'Sortie' Termansen 2011-11-05 18:49:30 +01:00
parent f9e10ab265
commit 884ce30c07
3 changed files with 12 additions and 3 deletions

View File

@ -283,6 +283,7 @@ namespace Sortix
if ( !initstart ) { Panic("could not construct ELF image for init process"); }
Thread* initthread = CreateThread(initstart);
if ( !initthread ) { Panic("could not create thread for the init process"); }
Scheduler::SetInitProcess(init);
// Lastly set up the timer driver and we are ready to run the OS.
Time::Init();

View File

@ -55,6 +55,7 @@ namespace Sortix
Thread* idlethread;
Thread* firstrunnablethread;
Thread* firstsleepingthread;
Process* initprocess;
bool hacksigintpending = false;
void Init()
@ -89,9 +90,14 @@ namespace Sortix
dummythread->process = process;
}
void SetInitialProcess(Process* init)
void SetInitProcess(Process* init)
{
dummythread->process = init;
initprocess = init;
}
Process* GetInitProcess()
{
return initprocess;
}
void MainLoop()

View File

@ -35,7 +35,9 @@ namespace Sortix
void MainLoop() SORTIX_NORETURN;
void Switch(CPU::InterruptRegisters* regs);
void SetIdleThread(Thread* thread);
void SetDummyThreadOwner(Process* init);
void SetDummyThreadOwner(Process* process);
void SetInitProcess(Process* init);
Process* GetInitProcess();
void SetThreadState(Thread* thread, Thread::State state);
Thread::State GetThreadState(Thread* thread);