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

LibCore: Allow event loops on other threads to wake up

Because the wake pipe is thread-local, it was previously not possible
to wake an event loop across a thread. Therefore, this commit
rearchitects event loop waking by making the wake function a member of
the event loop itself and having it keep a pointer to its thread's wake
pipe. The global wake() function calls wake on the current thread's
event loop.

This also fixes a bug in BackgroundAction: it should wake the event loop
it was created on, instead of the current thread's event loop.
This commit is contained in:
kleines Filmröllchen 2022-02-11 16:57:10 +01:00 committed by Andreas Kling
parent 716a3429fa
commit 704bb361bb
4 changed files with 27 additions and 9 deletions

View file

@ -849,7 +849,7 @@ void HackStudioWidget::initialize_debugger()
m_disassembly_widget->update_state(*Debugger::the().session(), regs);
HackStudioWidget::reveal_action_tab(*m_debug_info_widget);
});
Core::EventLoop::wake();
Core::EventLoop::wake_current();
return Debugger::HasControlPassedToUser::Yes;
},
@ -859,7 +859,7 @@ void HackStudioWidget::initialize_debugger()
if (m_current_editor_in_execution)
m_current_editor_in_execution->editor().clear_execution_position();
});
Core::EventLoop::wake();
Core::EventLoop::wake_current();
},
[this]() {
deferred_invoke([this] {
@ -879,7 +879,7 @@ void HackStudioWidget::initialize_debugger()
HackStudioWidget::hide_action_tabs();
GUI::MessageBox::show(window(), "Program Exited", "Debugger", GUI::MessageBox::Type::Information);
});
Core::EventLoop::wake();
Core::EventLoop::wake_current();
});
}