mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +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:
parent
806ade1367
commit
23902d46f1
1 changed files with 3 additions and 12 deletions
|
@ -133,19 +133,10 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Memory::Region> ker
|
||||||
|
|
||||||
Thread::~Thread()
|
Thread::~Thread()
|
||||||
{
|
{
|
||||||
{
|
VERIFY(!m_process_thread_list_node.is_in_list());
|
||||||
// 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());
|
|
||||||
|
|
||||||
// We shouldn't be queued
|
// We shouldn't be queued
|
||||||
VERIFY(m_runnable_priority < 0);
|
VERIFY(m_runnable_priority < 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread::BlockResult Thread::block_impl(BlockTimeout const& timeout, Blocker& blocker)
|
Thread::BlockResult Thread::block_impl(BlockTimeout const& timeout, Blocker& blocker)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue