mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 07:09:47 +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
Notes:
sideshowbarker
2024-07-17 17:49:11 +09:00
Author: https://github.com/awesomekling
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()
|
||||
{
|
||||
{
|
||||
// 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue