motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit f6773232ac738ff16c5e3572e3678019ba2a4b88 (tree)
parent 9deea9b1d8a393fc6a3a5ecc9f112009ee6dc3b2
Author: Frank Denis <github@pureftpd.org>
Date:   Sat, 20 Apr 2024 13:11:15 +0200

Fix WASI threads, again

Properly call the entrypoint when it doesn't return an optional error,
and use the per-thread copy of the arguments list.

Diffstat:
Mlib/std/Thread.zig | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig @@ -844,19 +844,19 @@ const WasiThreadImpl = struct { const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"; switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) { .NoReturn, .Void => { - @call(.auto, w, args); + @call(.auto, f, w.args); }, .Int => |info| { if (info.bits != 8) { @compileError(bad_fn_ret); } - _ = @call(.auto, w, args); // WASI threads don't support exit status, ignore value + _ = @call(.auto, f, w.args); // WASI threads don't support exit status, ignore value }, .ErrorUnion => |info| { if (info.payload != void) { @compileError(bad_fn_ret); } - @call(.auto, f, args) catch |err| { + @call(.auto, f, w.args) catch |err| { std.debug.print("error: {s}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { std.debug.dumpStackTrace(trace.*);