-
Notifications
You must be signed in to change notification settings - Fork 231
[C#] Simple Async support #1346
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
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # Cargo.lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a solid start, thanks!
return (uint)CallbackCode.Yield; | ||
"#); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to add a "TODO" comment here to remember to defer dropping borrowed resources until a result is returned (i.e. just before calling {name}TaskReturn
).
"# | ||
); | ||
|
||
let task_return_param = match &sig.results[..] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The task return function could accept up to 16 core parameters (e.g. 2 for a string
, 5 for a tuple<string, list<u8>, u32>
, etc.).
This PR add the very minimal changes to enable the first async functions tests to pass. These tests return immediately which means a lot of the callback, waitable, changes are not done yet. There are no TaskCompletionSources created, we just set the return value on the task. User code will look like
https://github.com/bytecodealliance/wit-bindgen/pull/1346/files#diff-f34015927bd91d8f86e20e1a9258891caad407de6a499fcf977cb1165c89b3a5
and
https://github.com/bytecodealliance/wit-bindgen/pull/1346/files#diff-756d40996fd1204ae5975dd4da40e815b827d804c27b13dd36f69b6612ced825
Which should be idiomatic.
Thanks @dicej for the help in Zulip.