mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
Kernel: Add a Finalizer process to take care of dying processes.
Instead of processes themselves getting scheduled to finish dying, let's have a Finalizer process that wakes up whenever someone is dying. This way we can do all kinds of lock-taking in process cleanup without risking reentering the scheduler.
This commit is contained in:
parent
e05237485c
commit
6cba80510e
5 changed files with 59 additions and 23 deletions
|
@ -60,6 +60,7 @@ public:
|
|||
|
||||
static Vector<pid_t> all_pids();
|
||||
static Vector<Process*> all_processes();
|
||||
static void finalize_dying_processes();
|
||||
|
||||
enum State {
|
||||
Invalid = 0,
|
||||
|
@ -70,6 +71,7 @@ public:
|
|||
Dying,
|
||||
Dead,
|
||||
BeingInspected,
|
||||
BlockedLurking,
|
||||
BlockedSleep,
|
||||
BlockedWait,
|
||||
BlockedRead,
|
||||
|
@ -135,6 +137,7 @@ public:
|
|||
void set_selector(word s) { m_far_ptr.selector = s; }
|
||||
void set_state(State s) { m_state = s; }
|
||||
void die();
|
||||
void finalize();
|
||||
|
||||
pid_t sys$setsid();
|
||||
pid_t sys$getsid(pid_t);
|
||||
|
@ -453,6 +456,7 @@ static inline const char* to_string(Process::State state)
|
|||
case Process::BlockedWrite: return "Write";
|
||||
case Process::BlockedSignal: return "Signal";
|
||||
case Process::BlockedSelect: return "Select";
|
||||
case Process::BlockedLurking: return "Lurking";
|
||||
case Process::BeingInspected: return "Inspect";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue