1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

Kernel: Don't lock scheduler in ~Thread()

This is not necessary, and is a leftover from before Thread started
using the ListedRefCounted pattern to be safely removed from lists on
the last call to unref().
This commit is contained in:
Andreas Kling 2022-08-19 13:59:15 +02:00
parent 806ade1367
commit 23902d46f1

View file

@ -133,19 +133,10 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Memory::Region> ker
Thread::~Thread()
{
{
// We need to explicitly remove ourselves from the thread list
// here. We may get preempted in the middle of destructing this
// thread, which causes problems if the thread list is iterated.
// Specifically, if this is the last thread of a process, checking
// block conditions would access m_process, which would be in
// the middle of being destroyed.
SpinlockLocker lock(g_scheduler_lock);
VERIFY(!m_process_thread_list_node.is_in_list());
VERIFY(!m_process_thread_list_node.is_in_list());
// We shouldn't be queued
VERIFY(m_runnable_priority < 0);
}
// We shouldn't be queued
VERIFY(m_runnable_priority < 0);
}
Thread::BlockResult Thread::block_impl(BlockTimeout const& timeout, Blocker& blocker)