From ce9daa48572a345ffd95e41d9f64b9e4719a88fa Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Thu, 22 Sep 2022 02:25:32 -0700 Subject: 1 event loop per thread. Instead of 3. uWebSockets and uSockets will need to be upgraded to match the changes. Previously: - Bun had a separate kqueue/eventfd just for async wakeups. - Bun had a separate kqueue/epoll just for reading files non-blocking in the same thread This commit unifies it into one event loop per thread --- src/io/io_linux.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/io/io_linux.zig') diff --git a/src/io/io_linux.zig b/src/io/io_linux.zig index d3af77d7c..00cc0c03e 100644 --- a/src/io/io_linux.zig +++ b/src/io/io_linux.zig @@ -987,9 +987,13 @@ pub const Completion = struct { pub const Waker = struct { fd: os.fd_t, - pub fn init(_: std.mem.Allocator) !Waker { + pub fn init(allocator: std.mem.Allocator) !Waker { + return try initWithFileDescriptor(allocator, try std.os.eventfd(0, 0)); + } + + pub fn initWithFileDescriptor(_: std.mem.Allocator, fd: os.fd_t) Waker { return Waker{ - .fd = try os.eventfd(0, 0), + .fd = fd, }; } -- cgit v1.2.3