summaryrefslogtreecommitdiff
path: root/Kernel/Thread.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-08-10 14:05:24 -0600
committerAndreas Kling <kling@serenityos.org>2020-08-11 14:54:36 +0200
commit49d5232f3350453cf45846580e506d6c79da10ba (patch)
treeded26fb0dcde08d3a4eefd09b80607d8d900c772 /Kernel/Thread.h
parent1f7190d3bdb4dea524a98786554a5314b75e5c72 (diff)
downloadserenity-49d5232f3350453cf45846580e506d6c79da10ba.zip
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
Diffstat (limited to 'Kernel/Thread.h')
-rw-r--r--Kernel/Thread.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Thread.h b/Kernel/Thread.h
index 0252333d9e..75d13371b7 100644
--- a/Kernel/Thread.h
+++ b/Kernel/Thread.h
@@ -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;