mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 20:42:11 +02:00
LibCore: Use IOCP for the event loop on Windows
This commit changes the event loop to use IOCPs instead of WaitForMultipleObjects to wait on events. This is done through the Nt kernel api NtAssociateWaitCompletionPacket which associates an event with a completion packet. Each completion packet notifies only once, as they are normally used to signal completion of an operation so to use them for notifiers they are associated again after each time they are triggered. There are more optimizations that can be done, such as reusing the EventLoopNotifier and EventLoopTimer structures to reduce the number of allocations and context switches for timer and notifier registration.
This commit is contained in:
Notes:
github-actions[bot]
2025-11-07 07:43:41 +00:00
Author: https://github.com/R-Goc Commit: https://github.com/LadybirdBrowser/ladybird/commit/86b95b1d7ac Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6053 Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/gmta ✅
@@ -34,7 +34,7 @@ public:
|
||||
static NonnullOwnPtr<EventLoopImplementationWindows> create() { return make<EventLoopImplementationWindows>(); }
|
||||
|
||||
EventLoopImplementationWindows();
|
||||
virtual ~EventLoopImplementationWindows() override = default;
|
||||
virtual ~EventLoopImplementationWindows() override;
|
||||
|
||||
virtual int exec() override;
|
||||
virtual size_t pump(PumpMode) override;
|
||||
@@ -48,8 +48,7 @@ private:
|
||||
bool m_exit_requested { false };
|
||||
int m_exit_code { 0 };
|
||||
|
||||
// The wake event handle of this event loop needs to be accessible from other threads.
|
||||
void*& m_wake_event;
|
||||
void const* m_wake_completion_key;
|
||||
};
|
||||
|
||||
using EventLoopManagerPlatform = EventLoopManagerWindows;
|
||||
|
||||
Reference in New Issue
Block a user