Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow @asyncCall with a real @Frame(func) rather than byte slice #3072

Closed
andrewrk opened this issue Aug 16, 2019 · 0 comments
Closed

allow @asyncCall with a real @Frame(func) rather than byte slice #3072

andrewrk opened this issue Aug 16, 2019 · 0 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@andrewrk
Copy link
Member

const std = @import("std");
const expect = std.testing.expect;

test "@asyncCall with actual frame instead of byte buffer" {
    var frame: @Frame(func) = undefined;
    var result: i32 = undefined;
    const ptr = @asyncCall(&frame, &result, func);
    resume ptr;
    expect(result == 1234);
}
fn func() i32 {
    suspend;
    return 1234;
}

expected to pass. actual output:

/home/andy/dev/zig/build/test.zig:7:29: error: expected type '[]u8', found '*@Frame(func)'
    const ptr = @asyncCall(&frame, &result, func);
                            ^

The point of this is to pass a result location to the function so that the result never has to get copied.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. stage1 The process of building from source via WebAssembly and the C backend. labels Aug 16, 2019
@andrewrk andrewrk added this to the 0.5.0 milestone Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

No branches or pull requests

1 participant