mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
Kernel: Always return from Thread::wait_on
We need to always return from Thread::wait_on, even when a thread is being killed. This is necessary so that the kernel call stack can clean up and release references held by it. Then, right before transitioning back to user mode, we check if the thread is supposed to die, and at that point change the thread state to Dying to prevent further scheduling of this thread. This addresses some possible resource leaks similar to #3073
This commit is contained in:
parent
1f7190d3bd
commit
49d5232f33
4 changed files with 28 additions and 33 deletions
|
@ -392,6 +392,7 @@ public:
|
|||
// Tell this thread to unblock if needed,
|
||||
// gracefully unwind the stack and die.
|
||||
void set_should_die();
|
||||
bool should_die() const { return m_should_die; }
|
||||
void die_if_needed();
|
||||
|
||||
bool tick();
|
||||
|
@ -521,7 +522,6 @@ public:
|
|||
private:
|
||||
IntrusiveListNode m_runnable_list_node;
|
||||
IntrusiveListNode m_wait_queue_node;
|
||||
WaitQueue* m_wait_queue { nullptr };
|
||||
|
||||
private:
|
||||
friend class SchedulerData;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue