authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2024-04-20 13:11:15+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-04-22 15:27:05-07:00
logfefdbca6e62145a20777789961262f15c2bf6cbe
tree7d7a2e0a1cc8df16f740bf1101d5ce879f42bba2
parent5d745d94fbe30334ce0695cdf7118fb526313aed

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.

1 files changed, 3 insertions(+), 3 deletions(-)

lib/std/Thread.zig+3-3
......@@ -844,19 +844,19 @@ const WasiThreadImpl = struct {
844844 const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'";
845845 switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) {
846846 .NoReturn, .Void => {
847 @call(.auto, w, args);
847 @call(.auto, f, w.args);
848848 },
849849 .Int => |info| {
850850 if (info.bits != 8) {
851851 @compileError(bad_fn_ret);
852852 }
853 _ = @call(.auto, w, args); // WASI threads don't support exit status, ignore value
853 _ = @call(.auto, f, w.args); // WASI threads don't support exit status, ignore value
854854 },
855855 .ErrorUnion => |info| {
856856 if (info.payload != void) {
857857 @compileError(bad_fn_ret);
858858 }
859 @call(.auto, f, args) catch |err| {
859 @call(.auto, f, w.args) catch |err| {
860860 std.debug.print("error: {s}\n", .{@errorName(err)});
861861 if (@errorReturnTrace()) |trace| {
862862 std.debug.dumpStackTrace(trace.*);