Skip to content

Simplify CABI async code #553

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

Merged
merged 1 commit into from
Aug 20, 2025
Merged

Simplify CABI async code #553

merged 1 commit into from
Aug 20, 2025

Conversation

lukewagner
Copy link
Member

This PR is just refactoring and shouldn't change the specified behavior. The PR reimplements how async works to be based on Python threads (threading.Thread), using locks to emulate fibers and cooperative switching instead of the current approach of using Python async/asyncio. This spun out of work to add cooperative threads, but it ended up being a significant simplification (kindof embarrassingly so) on its own, so I thought I'd spin it out into its own PR that could merge earlier.

The PR also adds a new top-level "Embedding" section to CanonicalABI.md (in the same spirit as core wasm's) that describes the top-level interaction between the embedder and wasm runtime which, with the asyncio impl, was rather ambiguous.

I'll leave the PR open for a while in case anyone who's familiar with the current Python code wants to take a look, review or comment, but if not that's fine too.

@lukewagner lukewagner force-pushed the refactor branch 3 times, most recently from ad31115 to 7cf90d1 Compare August 18, 2025 18:11
@lukewagner lukewagner merged commit 3dacde1 into main Aug 20, 2025
2 checks passed
@lukewagner lukewagner deleted the refactor branch August 20, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant