mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:07:44 +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
|
@ -13,6 +13,8 @@ public:
|
|||
Invalid = 0,
|
||||
Quit,
|
||||
Timer,
|
||||
NotifierRead,
|
||||
NotifierWrite,
|
||||
DeferredDestroy,
|
||||
DeferredInvoke,
|
||||
ChildAdded,
|
||||
|
@ -62,6 +64,36 @@ private:
|
|||
int m_timer_id;
|
||||
};
|
||||
|
||||
class CNotifierReadEvent final : public CEvent {
|
||||
public:
|
||||
explicit CNotifierReadEvent(int fd)
|
||||
: CEvent(CEvent::NotifierRead)
|
||||
, m_fd(fd)
|
||||
{
|
||||
}
|
||||
~CNotifierReadEvent() {}
|
||||
|
||||
int fd() const { return m_fd; }
|
||||
|
||||
private:
|
||||
int m_fd;
|
||||
};
|
||||
|
||||
class CNotifierWriteEvent final : public CEvent {
|
||||
public:
|
||||
explicit CNotifierWriteEvent(int fd)
|
||||
: CEvent(CEvent::NotifierWrite)
|
||||
, m_fd(fd)
|
||||
{
|
||||
}
|
||||
~CNotifierWriteEvent() {}
|
||||
|
||||
int fd() const { return m_fd; }
|
||||
|
||||
private:
|
||||
int m_fd;
|
||||
};
|
||||
|
||||
class CChildEvent final : public CEvent {
|
||||
public:
|
||||
CChildEvent(Type, CObject& child);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue