summaryrefslogtreecommitdiff
path: root/Libraries/LibCore/CEvent.h
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-07-16 20:31:14 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-16 20:47:32 +0200
commitd8387f1506c90091d615ee7ba3ebb7bb0381a155 (patch)
treeb9ebcfc1eeea647767977500be51918e3d42de74 /Libraries/LibCore/CEvent.h
parenta714fc661dfcea3330cedcfbf9ef93092fadba59 (diff)
downloadserenity-d8387f1506c90091d615ee7ba3ebb7bb0381a155.zip
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.
Diffstat (limited to 'Libraries/LibCore/CEvent.h')
-rw-r--r--Libraries/LibCore/CEvent.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/Libraries/LibCore/CEvent.h b/Libraries/LibCore/CEvent.h
index 6238cc59a4..cd5342eb55 100644
--- a/Libraries/LibCore/CEvent.h
+++ b/Libraries/LibCore/CEvent.h
@@ -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);