kernel: Also move children's parent to PID 1 in the common thread exit function
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e60b2a3d2f
commit
54a1998d42
@ -7,10 +7,5 @@ Result<u64> sys_exit(Registers*, SyscallArgs args)
|
|||||||
|
|
||||||
Thread* current = Scheduler::current();
|
Thread* current = Scheduler::current();
|
||||||
|
|
||||||
Scheduler::for_each_child(current, [](Thread* child) {
|
|
||||||
child->parent = Scheduler::init_thread();
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
current->exit_and_signal_parent(status);
|
current->exit_and_signal_parent(status);
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,11 @@ Result<SharedPtr<VFS::Inode>> Thread::resolve_atfile(int dirfd, const String& pa
|
|||||||
if (is_kernel) state = ThreadState::Dying;
|
if (is_kernel) state = ThreadState::Dying;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Scheduler::for_each_child(this, [](Thread* child) {
|
||||||
|
child->parent = Scheduler::init_thread();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
if (parent && parent->state == ThreadState::Waiting)
|
if (parent && parent->state == ThreadState::Waiting)
|
||||||
{
|
{
|
||||||
auto child = *parent->child_being_waited_for;
|
auto child = *parent->child_being_waited_for;
|
||||||
@ -83,6 +88,7 @@ Result<SharedPtr<VFS::Inode>> Thread::resolve_atfile(int dirfd, const String& pa
|
|||||||
parent->wake_up();
|
parent->wake_up();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state = ThreadState::Exited;
|
state = ThreadState::Exited;
|
||||||
}
|
}
|
||||||
status = _status;
|
status = _status;
|
||||||
|
Loading…
Reference in New Issue
Block a user