mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-09 23:29:03 +00:00
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.
This commit is contained in:
parent
5d745d94fb
commit
fefdbca6e6
1 changed files with 3 additions and 3 deletions
|
|
@ -844,19 +844,19 @@ const WasiThreadImpl = struct {
|
||||||
const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'";
|
const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'";
|
||||||
switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) {
|
switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) {
|
||||||
.NoReturn, .Void => {
|
.NoReturn, .Void => {
|
||||||
@call(.auto, w, args);
|
@call(.auto, f, w.args);
|
||||||
},
|
},
|
||||||
.Int => |info| {
|
.Int => |info| {
|
||||||
if (info.bits != 8) {
|
if (info.bits != 8) {
|
||||||
@compileError(bad_fn_ret);
|
@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| {
|
.ErrorUnion => |info| {
|
||||||
if (info.payload != void) {
|
if (info.payload != void) {
|
||||||
@compileError(bad_fn_ret);
|
@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)});
|
std.debug.print("error: {s}\n", .{@errorName(err)});
|
||||||
if (@errorReturnTrace()) |trace| {
|
if (@errorReturnTrace()) |trace| {
|
||||||
std.debug.dumpStackTrace(trace.*);
|
std.debug.dumpStackTrace(trace.*);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue