authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-07 19:41:26-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-08 12:36:41-08:00
log09028bac291287ed58c2950f2a4b11e3353c4d1d
tree34081be7263825e1c517b954cea41ab3a19ea22a
parent20baf049aac53072d729f5a1791ecad8a927c34d

std.Io.Threaded: fix init for single-threaded


1 files changed, 14 insertions(+), 2 deletions(-)

lib/std/Io/Threaded.zig+14-2
...@@ -1229,7 +1229,19 @@ pub fn init(...@@ -1229,7 +1229,19 @@ pub fn init(
1229 gpa: Allocator,1229 gpa: Allocator,
1230 options: InitOptions,1230 options: InitOptions,
1231) Threaded {1231) Threaded {
1232 if (builtin.single_threaded) return .init_single_threaded;1232 if (builtin.single_threaded) return .{
1233 .allocator = gpa,
1234 .stack_size = options.stack_size,
1235 .async_limit = options.async_limit orelse init_single_threaded.async_limit,
1236 .cpu_count_error = init_single_threaded.cpu_count_error,
1237 .concurrent_limit = options.concurrent_limit,
1238 .old_sig_io = undefined,
1239 .old_sig_pipe = undefined,
1240 .have_signal_handler = init_single_threaded.have_signal_handler,
1241 .argv0 = options.argv0,
1242 .environ = .{ .process_environ = options.environ },
1243 .worker_threads = init_single_threaded.worker_threads,
1244 };
12331245
1234 const cpu_count = std.Thread.getCpuCount();1246 const cpu_count = std.Thread.getCpuCount();
12351247
...@@ -1243,8 +1255,8 @@ pub fn init(...@@ -1243,8 +1255,8 @@ pub fn init(
1243 .old_sig_pipe = undefined,1255 .old_sig_pipe = undefined,
1244 .have_signal_handler = false,1256 .have_signal_handler = false,
1245 .argv0 = options.argv0,1257 .argv0 = options.argv0,
1246 .worker_threads = .init(null),
1247 .environ = .{ .process_environ = options.environ },1258 .environ = .{ .process_environ = options.environ },
1259 .worker_threads = .init(null),
1248 };1260 };
12491261
1250 if (posix.Sigaction != void) {1262 if (posix.Sigaction != void) {