Add thread and process states.
Add a thread exit call.
This commit is contained in:
parent
8d87791fa2
commit
a06c9dced4
8 changed files with 78 additions and 9 deletions
|
|
@ -7,6 +7,12 @@ class Thread;
|
|||
|
||||
class Process {
|
||||
public:
|
||||
enum State {
|
||||
UNSPECIFIED,
|
||||
SETUP,
|
||||
RUNNING,
|
||||
FINISHED,
|
||||
};
|
||||
// Caller takes ownership of returned process.
|
||||
static Process* RootProcess();
|
||||
Process(uint64_t elf_ptr);
|
||||
|
|
@ -17,10 +23,17 @@ class Process {
|
|||
void CreateThread(uint64_t elf_ptr);
|
||||
Thread* GetThread(uint64_t tid);
|
||||
|
||||
// Checks the state of all child threads and transitions to
|
||||
// finished if all have finished.
|
||||
void CheckState();
|
||||
|
||||
State GetState() { return state_; }
|
||||
|
||||
private:
|
||||
Process(uint64_t id, uint64_t cr3) : id_(id), cr3_(cr3) {}
|
||||
uint64_t id_;
|
||||
uint64_t cr3_;
|
||||
State state_;
|
||||
|
||||
uint64_t next_thread_id_ = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue