commit 09028bac291287ed58c2950f2a4b11e3353c4d1d (tree)
parent 20baf049aac53072d729f5a1791ecad8a927c34d
Author: Andrew Kelley <andrew@ziglang.org>
Date: Wed, 7 Jan 2026 19:41:26 -0800
std.Io.Threaded: fix init for single-threaded
Diffstat:
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
@@ -1229,7 +1229,19 @@ pub fn init(
gpa: Allocator,
options: InitOptions,
) Threaded {
- if (builtin.single_threaded) return .init_single_threaded;
+ if (builtin.single_threaded) return .{
+ .allocator = gpa,
+ .stack_size = options.stack_size,
+ .async_limit = options.async_limit orelse init_single_threaded.async_limit,
+ .cpu_count_error = init_single_threaded.cpu_count_error,
+ .concurrent_limit = options.concurrent_limit,
+ .old_sig_io = undefined,
+ .old_sig_pipe = undefined,
+ .have_signal_handler = init_single_threaded.have_signal_handler,
+ .argv0 = options.argv0,
+ .environ = .{ .process_environ = options.environ },
+ .worker_threads = init_single_threaded.worker_threads,
+ };
const cpu_count = std.Thread.getCpuCount();
@@ -1243,8 +1255,8 @@ pub fn init(
.old_sig_pipe = undefined,
.have_signal_handler = false,
.argv0 = options.argv0,
- .worker_threads = .init(null),
.environ = .{ .process_environ = options.environ },
+ .worker_threads = .init(null),
};
if (posix.Sigaction != void) {