[Zion] Add a ProcessWait syscall.
This commit is contained in:
parent
642fc4d80d
commit
d9a4be6555
8 changed files with 29 additions and 8 deletions
|
|
@ -59,10 +59,11 @@ uint64_t Process::AddExistingCapability(const glcr::RefPtr<Capability>& cap) {
|
|||
return caps_.AddExistingCapability(cap);
|
||||
}
|
||||
|
||||
void Process::Exit() {
|
||||
void Process::Exit(uint64_t exit_code) {
|
||||
// TODO: Check this state elsewhere to ensure that we don't for instance
|
||||
// create a running thread on a finished process.
|
||||
state_ = CLEANUP;
|
||||
exit_code_ = exit_code;
|
||||
|
||||
for (uint64_t i = 0; i < threads_.size(); i++) {
|
||||
if (!threads_[i]->IsDying()) {
|
||||
|
|
|
|||
|
|
@ -57,10 +57,11 @@ class Process : public KernelObject {
|
|||
uint64_t AddExistingCapability(const glcr::RefPtr<Capability>& cap);
|
||||
|
||||
State GetState() { return state_; }
|
||||
uint64_t exit_code() { return exit_code_; }
|
||||
|
||||
// This stops all of the processes threads (they will no longer be scheduled)
|
||||
// and flags the process for cleanup.
|
||||
void Exit();
|
||||
void Exit(uint64_t code);
|
||||
|
||||
// This *should not* be called from a thread that belongs to this process.
|
||||
// Rather it should be called from the cleanup thread.
|
||||
|
|
@ -76,6 +77,7 @@ class Process : public KernelObject {
|
|||
uint64_t id_;
|
||||
glcr::RefPtr<AddressSpace> vmas_;
|
||||
State state_;
|
||||
uint64_t exit_code_ = -1;
|
||||
|
||||
uint64_t next_thread_id_ = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue