1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48: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:
Andreas Kling 2023-04-26 18:51:07 +02:00 committed by Sam Atkins
parent 7035a19645
commit b61a87c03c
7 changed files with 22 additions and 35 deletions

View file

@ -12,7 +12,10 @@
namespace Core {
EventLoopImplementation::EventLoopImplementation() = default;
EventLoopImplementation::EventLoopImplementation()
: m_thread_event_queue(ThreadEventQueue::current())
{
}
EventLoopImplementation::~EventLoopImplementation() = default;
@ -29,20 +32,8 @@ void EventLoopManager::install(Core::EventLoopManager& manager)
s_event_loop_manager = &manager;
}
EventLoopManager::EventLoopManager()
: m_thread_event_queue(ThreadEventQueue::current())
{
}
EventLoopManager::EventLoopManager() = default;
EventLoopManager::~EventLoopManager() = default;
void EventLoopManager::post_event(Object& receiver, NonnullOwnPtr<Event>&& event)
{
m_thread_event_queue.post_event(receiver, move(event));
// Wake up this EventLoopImplementation if this is a cross-thread event posting.
if (&ThreadEventQueue::current() != &m_thread_event_queue)
wake();
}
}