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

LibCore: Remove main event loop

The main event loop functionality was used in just two places where the
alternative is a bit simpler. Remove it in favor of referencing the
event loop directly, or just invoking `EventLoop::current()`.

Note that we don't need locking in the constructor since we're now only
modifying a thread-local `Vector`. We also don't need locking in the
old call sites to `::with_main_locked()` since we already lock the
event loop in the subsequent `::post_event()` invocation.
This commit is contained in:
Jelle Raaijmakers 2022-04-24 01:48:11 +02:00 committed by Linus Groh
parent 9e2a619fdc
commit f25123df66
4 changed files with 21 additions and 46 deletions

View file

@ -123,7 +123,7 @@ void ThreadStackWidget::refresh()
[weak_this = make_weak_ptr()](auto result) {
if (!weak_this)
return;
Core::EventLoop::with_main_locked([&](auto* main_event_loop) { main_event_loop->post_event(const_cast<Core::Object&>(*weak_this), make<CompletionEvent>(move(result))); });
Core::EventLoop::current().post_event(const_cast<Core::Object&>(*weak_this), make<CompletionEvent>(move(result)));
});
}