mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
LibCore: Move post_event() back to EventLoopImplementation
This shouldn't have been moved to EventLoopManager, as the manager is global and one-per-process, and the implementation is one-per-loop. This makes cross-thread event posting work again, and unbreaks SoundPlayer (and probably other things as well.)
This commit is contained in:
parent
7035a19645
commit
b61a87c03c
7 changed files with 22 additions and 35 deletions
|
@ -126,6 +126,13 @@ bool EventLoopImplementationUnix::was_exit_requested() const
|
|||
return m_exit_requested;
|
||||
}
|
||||
|
||||
void EventLoopImplementationUnix::post_event(Object& receiver, NonnullOwnPtr<Event>&& event)
|
||||
{
|
||||
m_thread_event_queue.post_event(receiver, move(event));
|
||||
if (&m_thread_event_queue != &ThreadEventQueue::current())
|
||||
wake();
|
||||
}
|
||||
|
||||
void EventLoopImplementationUnix::wake()
|
||||
{
|
||||
int wake_event = 0;
|
||||
|
@ -138,13 +145,6 @@ void EventLoopManagerUnix::wake()
|
|||
MUST(Core::System::write(ThreadData::the().wake_pipe_fds[1], { &wake_event, sizeof(wake_event) }));
|
||||
}
|
||||
|
||||
void EventLoopManagerUnix::deferred_invoke(Function<void()> invokee)
|
||||
{
|
||||
// FIXME: Get rid of the useless DeferredInvocationContext object.
|
||||
auto context = DeferredInvocationContext::construct();
|
||||
post_event(context, make<DeferredInvocationEvent>(context, move(invokee)));
|
||||
}
|
||||
|
||||
void EventLoopManagerUnix::wait_for_events(EventLoopImplementation::PumpMode mode)
|
||||
{
|
||||
auto& thread_data = ThreadData::the();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue