[Zion] Add a framework for better process exit.
This commit is contained in:
parent
aa2d80b557
commit
308dd6a203
9 changed files with 80 additions and 8 deletions
|
|
@ -29,6 +29,7 @@ class Thread : public KernelObject, public glcr::IntrusiveListNode<Thread> {
|
|||
RUNNING,
|
||||
RUNNABLE,
|
||||
BLOCKED,
|
||||
CLEANUP,
|
||||
FINISHED,
|
||||
};
|
||||
static glcr::RefPtr<Thread> RootThread(Process& root_proc);
|
||||
|
|
@ -51,8 +52,17 @@ class Thread : public KernelObject, public glcr::IntrusiveListNode<Thread> {
|
|||
// State Management.
|
||||
State GetState() { return state_; };
|
||||
void SetState(State state) { state_ = state; }
|
||||
bool IsDying() { return state_ == CLEANUP || state_ == FINISHED; }
|
||||
|
||||
// Exits this thread.
|
||||
// Allows all blocked threads to run and releases the kernel stack.
|
||||
// This function should only be called by the running thread on itself
|
||||
// as it will yield.
|
||||
void Exit();
|
||||
|
||||
// Like Exit except it does not yield.
|
||||
void Cleanup();
|
||||
|
||||
void Wait();
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue