| author | |
| committer | |
| log | 486a774e5fa079c4caba334f311ee32b54272f1f |
| tree | 4ff352cd107590dd9b379167c20a44cb6b278746 |
| parent | 4170f3f77f23bca52a2a9b24d1a249fae35c04ac |
std.event.Loop does not yet work in single threaded builds. However,
using evented io on a single thread can be very convenient. This commit
allows settind @import("root").event_loop_mode to .single_threaded
in order to allow this without reimplementing the startup code in
start.zig1 files changed, 2 insertions(+), 1 deletions(-)
lib/std/event/loop.zig+2-1| ... | ... | @@ -112,7 +112,8 @@ pub const Loop = struct { |
| 112 | 112 | /// have the correct pointer value. |
| 113 | 113 | /// https://github.com/ziglang/zig/issues/2761 and https://github.com/ziglang/zig/issues/2765 |
| 114 | 114 | pub fn init(self: *Loop) !void { |
| 115 | if (builtin.single_threaded) { | |
| 115 | if (builtin.single_threaded | |
| 116 | or (@hasDecl(root, "event_loop_mode") and root.event_loop_mode == .single_threaded)) { | |
| 116 | 117 | return self.initSingleThreaded(); |
| 117 | 118 | } else { |
| 118 | 119 | return self.initMultiThreaded(); |