-
Notifications
You must be signed in to change notification settings - Fork 85
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
async: How does cross-task communication work? #459
Comments
I wrote up some other somewhat related thoughs at bytecodealliance/wit-bindgen#1182 |
This is a great question. Indeed, this is the last thing on the "todo" list to add to the 0.3.0 proposal; I've just been waiting for someone to hit the concrete question so we could consider the solution in that context. So one observation is that: if we didn't care about using If we do care about
where
Like My hope here is that the symmetry (with core wasm and the browser) would make it easier to integrate in core parts of the toolchain. But happy to discuss alternatives; it seems like there are a number of solutions that could work. I think the main thing is some new built-in that produces a waitable-table index that can be waited on like normal and signaled from wasm without requiring calling an import. |
At least for the use case I was thinking of Rust's support we'd definitely want to support the That's why
Where when a task blocks on an async mutex it's "to be notified" handle knows the original task's ID (by calling |
Agreed we could do something custom that is perhaps simpler. My initial thoughts were exactly along the lines of what you wrote. The question that put me on the |
I've talked with @lukewagner and @dicej in various degrees about this problem before, but I wanted to try to write up an issue with my thoughts about something concrete at least. At a high level I'm curious how an "async mutex" would work within a component, but I'm going to attempt to make this more specific as well.
Let's say I have a hypothetical setup like this:
run
.run
to create task T1.run
again to create task T2.callback
ABI here, so this would return. Is this allowed? Returning while blocking on nothing?My vague undersatnding is that T2 traps when it returns waiting for the lock, but I'm also still booting up on all the canonical ABI pieces.
The text was updated successfully, but these errors were encountered: