| ... | ... | @@ -149,13 +149,14 @@ pub const Loop = struct { |
| 149 | 149 | .overlapped = ResumeNode.overlapped_init, |
| 150 | 150 | }, |
| 151 | 151 | }; |
| 152 | | const extra_thread_count = thread_count - 1; |
| 152 | // We need an extra one of these in case the fs thread wants to use onNextTick |
| 153 | 153 | self.eventfd_resume_nodes = try self.allocator.alloc( |
| 154 | 154 | std.atomic.Stack(ResumeNode.EventFd).Node, |
| 155 | | extra_thread_count, |
| 155 | thread_count, |
| 156 | 156 | ); |
| 157 | 157 | errdefer self.allocator.free(self.eventfd_resume_nodes); |
| 158 | 158 | |
| 159 | const extra_thread_count = thread_count - 1; |
| 159 | 160 | self.extra_threads = try self.allocator.alloc(*Thread, extra_thread_count); |
| 160 | 161 | errdefer self.allocator.free(self.extra_threads); |
| 161 | 162 | |
| ... | ... | @@ -197,7 +198,7 @@ pub const Loop = struct { |
| 197 | 198 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ |
| 198 | 199 | .data = ResumeNode.EventFd{ |
| 199 | 200 | .base = ResumeNode{ |
| 200 | | .id = ResumeNode.Id.EventFd, |
| 201 | .id = .EventFd, |
| 201 | 202 | .handle = undefined, |
| 202 | 203 | .overlapped = ResumeNode.overlapped_init, |
| 203 | 204 | }, |
| ... | ... | @@ -454,12 +455,12 @@ pub const Loop = struct { |
| 454 | 455 | self.finishOneEvent(); |
| 455 | 456 | } |
| 456 | 457 | |
| 457 | | pub async fn linuxWaitFd(self: *Loop, fd: i32, flags: u32) !void { |
| 458 | pub fn linuxWaitFd(self: *Loop, fd: i32, flags: u32) !void { |
| 458 | 459 | defer self.linuxRemoveFd(fd); |
| 459 | 460 | suspend { |
| 460 | 461 | var resume_node = ResumeNode.Basic{ |
| 461 | 462 | .base = ResumeNode{ |
| 462 | | .id = ResumeNode.Id.Basic, |
| 463 | .id = .Basic, |
| 463 | 464 | .handle = @frame(), |
| 464 | 465 | .overlapped = ResumeNode.overlapped_init, |
| 465 | 466 | }, |
| ... | ... | @@ -793,8 +794,8 @@ pub const Loop = struct { |
| 793 | 794 | |
| 794 | 795 | fn posixFsRun(self: *Loop) void { |
| 795 | 796 | while (true) { |
| 796 | | if (builtin.os == builtin.Os.linux) { |
| 797 | | _ = @atomicRmw(i32, &self.os_data.fs_queue_item, AtomicRmwOp.Xchg, 0, AtomicOrder.SeqCst); |
| 797 | if (builtin.os == .linux) { |
| 798 | _ = @atomicRmw(i32, &self.os_data.fs_queue_item, .Xchg, 0, .SeqCst); |
| 798 | 799 | } |
| 799 | 800 | while (self.os_data.fs_queue.get()) |node| { |
| 800 | 801 | switch (node.data.msg) { |
| ... | ... | @@ -833,14 +834,14 @@ pub const Loop = struct { |
| 833 | 834 | self.finishOneEvent(); |
| 834 | 835 | } |
| 835 | 836 | switch (builtin.os) { |
| 836 | | builtin.Os.linux => { |
| 837 | .linux => { |
| 837 | 838 | const rc = os.linux.futex_wait(&self.os_data.fs_queue_item, os.linux.FUTEX_WAIT, 0, null); |
| 838 | 839 | switch (os.linux.getErrno(rc)) { |
| 839 | 840 | 0, os.EINTR, os.EAGAIN => continue, |
| 840 | 841 | else => unreachable, |
| 841 | 842 | } |
| 842 | 843 | }, |
| 843 | | builtin.Os.macosx, builtin.Os.freebsd, builtin.Os.netbsd => { |
| 844 | .macosx, .freebsd, .netbsd => { |
| 844 | 845 | const fs_kevs = (*const [1]os.Kevent)(&self.os_data.fs_kevent_wait); |
| 845 | 846 | var out_kevs: [1]os.Kevent = undefined; |
| 846 | 847 | _ = os.kevent(self.os_data.fs_kqfd, fs_kevs, out_kevs[0..], null) catch unreachable; |