mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
Kernel: Fix broken destruction order for Process/Thread.
This commit is contained in:
parent
b6cd66c3b5
commit
5713c3a0cb
4 changed files with 7 additions and 4 deletions
1
Kernel/.gitignore
vendored
1
Kernel/.gitignore
vendored
|
@ -7,3 +7,4 @@ kernel.map
|
|||
_fs_contents
|
||||
sync-local.sh
|
||||
*.pcap
|
||||
eth_null*
|
||||
|
|
|
@ -617,7 +617,7 @@ Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring
|
|||
|
||||
Process::~Process()
|
||||
{
|
||||
dbgprintf("~Process{%p} name=%s pid=%d\n", this, m_name.characters(), pid());
|
||||
dbgprintf("~Process{%p} name=%s pid=%d, m_fds=%d\n", this, m_name.characters(), pid(), m_fds.size());
|
||||
InterruptDisabler disabler;
|
||||
system.nprocess--;
|
||||
|
||||
|
@ -1930,6 +1930,8 @@ void Process::finalize()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_dead = true;
|
||||
}
|
||||
|
||||
void Process::die()
|
||||
|
|
|
@ -53,8 +53,7 @@ public:
|
|||
Ring3 = 3,
|
||||
};
|
||||
|
||||
// FIXME(Thread): Is this really how this should work?
|
||||
bool is_dead() const { return main_thread().state() == Thread::State::Dead; }
|
||||
bool is_dead() const { return m_dead; }
|
||||
|
||||
Thread::State state() const { return main_thread().state(); }
|
||||
|
||||
|
@ -311,6 +310,7 @@ private:
|
|||
HashTable<gid_t> m_gids;
|
||||
|
||||
bool m_being_inspected { false };
|
||||
bool m_dead { false };
|
||||
|
||||
int m_next_tid { 0 };
|
||||
};
|
||||
|
|
|
@ -72,7 +72,7 @@ bool Scheduler::pick_next()
|
|||
|
||||
if (thread.state() == Thread::BlockedWait) {
|
||||
process.for_each_child([&] (Process& child) {
|
||||
if (child.state() != Thread::Dead)
|
||||
if (!child.is_dead())
|
||||
return true;
|
||||
if (thread.waitee_pid() == -1 || thread.waitee_pid() == child.pid()) {
|
||||
thread.m_waitee_pid = child.pid();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue