mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +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:
parent
a714fc661d
commit
d8387f1506
4 changed files with 50 additions and 3 deletions
|
@ -21,3 +21,14 @@ void CNotifier::set_enabled(bool enabled)
|
|||
else
|
||||
CEventLoop::unregister_notifier({}, *this);
|
||||
}
|
||||
|
||||
void CNotifier::event(CEvent& event)
|
||||
{
|
||||
if (event.type() == CEvent::NotifierRead && on_ready_to_read) {
|
||||
on_ready_to_read();
|
||||
} else if (event.type() == CEvent::NotifierWrite && on_ready_to_write) {
|
||||
on_ready_to_write();
|
||||
} else {
|
||||
CObject::event(event);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue