| ... | @@ -687,9 +687,14 @@ pub const Loop = struct { | ... | @@ -687,9 +687,14 @@ pub const Loop = struct { |
| 687 | | 687 | |
| 688 | switch (builtin.os.tag) { | 688 | switch (builtin.os.tag) { |
| 689 | .linux => { | 689 | .linux => { |
| 690 | // writing 8 bytes to an eventfd cannot fail | 690 | // writing to the eventfd will only wake up one thread, thus multiple writes |
| 691 | const amt = os.write(self.os_data.final_eventfd, &wakeup_bytes) catch unreachable; | 691 | // are needed to wakeup all the threads |
| 692 | assert(amt == wakeup_bytes.len); | 692 | var i: usize = 0; |
| | 693 | while (i < self.extra_threads.len + 1) : (i += 1) { |
| | 694 | // writing 8 bytes to an eventfd cannot fail |
| | 695 | const amt = os.write(self.os_data.final_eventfd, &wakeup_bytes) catch unreachable; |
| | 696 | assert(amt == wakeup_bytes.len); |
| | 697 | } |
| 693 | return; | 698 | return; |
| 694 | }, | 699 | }, |
| 695 | .macosx, .freebsd, .netbsd, .dragonfly => { | 700 | .macosx, .freebsd, .netbsd, .dragonfly => { |
| ... | @@ -1252,11 +1257,6 @@ test "std.event.Loop - basic" { | ... | @@ -1252,11 +1257,6 @@ test "std.event.Loop - basic" { |
| 1252 | // https://github.com/ziglang/zig/issues/1908 | 1257 | // https://github.com/ziglang/zig/issues/1908 |
| 1253 | if (builtin.single_threaded) return error.SkipZigTest; | 1258 | if (builtin.single_threaded) return error.SkipZigTest; |
| 1254 | | 1259 | |
| 1255 | if (true) { | | |
| 1256 | // https://github.com/ziglang/zig/issues/4922 | | |
| 1257 | return error.SkipZigTest; | | |
| 1258 | } | | |
| 1259 | | | |
| 1260 | var loop: Loop = undefined; | 1260 | var loop: Loop = undefined; |
| 1261 | try loop.initMultiThreaded(); | 1261 | try loop.initMultiThreaded(); |
| 1262 | defer loop.deinit(); | 1262 | defer loop.deinit(); |