aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
authorFrank Denis <github@pureftpd.org>2024-04-20 13:11:15 +0200
committerAndrew Kelley <andrew@ziglang.org>2024-04-22 15:27:05 -0700
commitfefdbca6e62145a20777789961262f15c2bf6cbe (patch)
tree7d7a2e0a1cc8df16f740bf1101d5ce879f42bba2 /lib/std/Thread.zig
parent5d745d94fbe30334ce0695cdf7118fb526313aed (diff)
downloadzig-fefdbca6e62145a20777789961262f15c2bf6cbe.tar.gz
zig-fefdbca6e62145a20777789961262f15c2bf6cbe.zip
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 (limited to 'lib/std/Thread.zig')
-rw-r--r--lib/std/Thread.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index d1c8a24f0a..503f646dc4 100644
--- 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.*);