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

CNotifier: Turn into a CObject and Use the event queue to deliver events

This way, CNotifier can mutate state to its little heart's content
without destroying the world when the global CNotifier hash changes
during delivery.
This commit is contained in:
Robin Burchell 2019-07-16 20:31:14 +02:00 committed by Andreas Kling
parent a714fc661d
commit d8387f1506
4 changed files with 50 additions and 3 deletions

View file

@ -245,11 +245,11 @@ void CEventLoop::wait_for_event(WaitMode mode)
for (auto& notifier : *s_notifiers) {
if (FD_ISSET(notifier->fd(), &rfds)) {
if (notifier->on_ready_to_read)
notifier->on_ready_to_read();
post_event(*notifier, make<CNotifierReadEvent>(notifier->fd()));
}
if (FD_ISSET(notifier->fd(), &wfds)) {
if (notifier->on_ready_to_write)
notifier->on_ready_to_write();
post_event(*notifier, make<CNotifierWriteEvent>(notifier->fd()));
}
}