1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:17:35 +00:00

LibCore: Move event queueing to a per-thread event queue

Instead of juggling events between individual instances of
Core::EventLoop, move queueing and processing to a separate per-thread
queue (ThreadEventQueue).
This commit is contained in:
Andreas Kling 2023-04-23 19:45:12 +02:00
parent 3a70a16ca7
commit 1587caef84
6 changed files with 184 additions and 102 deletions

View file

@ -111,11 +111,6 @@ public:
};
static void notify_forked(ForkEvent);
void take_pending_events_from(EventLoop& other)
{
m_queued_events.extend(move(other.m_queued_events));
}
static EventLoop& current();
private:
@ -124,20 +119,6 @@ private:
static void dispatch_signal(int);
static void handle_signal(int);
struct QueuedEvent {
AK_MAKE_NONCOPYABLE(QueuedEvent);
public:
QueuedEvent(Object& receiver, NonnullOwnPtr<Event>);
QueuedEvent(QueuedEvent&&);
~QueuedEvent() = default;
WeakPtr<Object> receiver;
NonnullOwnPtr<Event> event;
};
Vector<QueuedEvent, 64> m_queued_events;
Vector<NonnullRefPtr<Promise<NonnullRefPtr<Object>>>> m_pending_promises;
static pid_t s_pid;
bool m_exit_requested { false };