LibCore: Allow posting stateless events without heap-allocated Event

This patch adds an API for posting a Core::Event::Type to the thread
event queue without requiring a full Core::Event object.

We use this API to avoid heap allocations for every timer and notifier
activation event.
This commit is contained in:
Andreas Kling 2025-12-03 11:38:19 +01:00 committed by Andreas Kling
parent 23fb9781d1
commit 69515f8c85
Notes: github-actions[bot] 2025-12-03 12:27:51 +00:00
5 changed files with 48 additions and 15 deletions

View file

@ -210,7 +210,7 @@ public:
}
}
ThreadEventQueue::current().post_event(strong_owner, make<TimerEvent>());
ThreadEventQueue::current().post_event(strong_owner, Event::Type::Timer);
}
AK::Duration interval;
@ -405,7 +405,7 @@ try_select_again:
#ifdef AK_OS_ANDROID
// FIXME: Make the check work under Android, perhaps use ALooper.
ThreadEventQueue::current().post_event(notifier, make<NotifierActivationEvent>());
ThreadEventQueue::current().post_event(notifier, Core::Event::Type::NotifierActivation);
#else
auto revents = thread_data.poll_fds[i].revents;
@ -422,7 +422,7 @@ try_select_again:
type &= notifier.type();
if (type != NotificationType::None)
ThreadEventQueue::current().post_event(&notifier, make<NotifierActivationEvent>());
ThreadEventQueue::current().post_event(&notifier, Core::Event::Type::NotifierActivation);
#endif
}
}