1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +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

@ -298,12 +298,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
size_t thread_index = 0;
coredump->for_each_thread_info([&](auto& thread_info) {
results.thread_backtraces.append(build_backtrace(*coredump, thread_info, thread_index, [&](size_t frame_index, size_t frame_count) {
Core::EventLoop::with_main_locked([&](auto& main) {
main->deferred_invoke([&, frame_index, frame_count] {
window->set_progress(100.0f * (float)(frame_index + 1) / (float)frame_count);
progressbar.set_value(frame_index + 1);
progressbar.set_max(frame_count);
});
app->event_loop().deferred_invoke([&, frame_index, frame_count] {
window->set_progress(100.0f * (float)(frame_index + 1) / (float)frame_count);
progressbar.set_value(frame_index + 1);
progressbar.set_max(frame_count);
});
}));
results.thread_cpu_registers.append(build_cpu_registers(thread_info, thread_index));