Skip to content

Commit e7ce451

Browse files
committed
Kernel: Disable interrupts in Thread::set_state().
We don't want to get interrupted while we're manipulating the thread lists.
1 parent 802d4dc commit e7ce451

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Kernel/Thread.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ bool Thread::is_thread(void* ptr)
568568

569569
void Thread::set_thread_list(InlineLinkedList<Thread>* thread_list)
570570
{
571+
ASSERT_INTERRUPTS_DISABLED();
571572
ASSERT(pid() != 0);
572573
if (m_thread_list == thread_list)
573574
return;
@@ -580,6 +581,7 @@ void Thread::set_thread_list(InlineLinkedList<Thread>* thread_list)
580581

581582
void Thread::set_state(State new_state)
582583
{
584+
InterruptDisabler disabler;
583585
m_state = new_state;
584586
if (m_process.pid() != 0)
585587
set_thread_list(thread_list_for_state(new_state));

0 commit comments

Comments
 (0)