-
Notifications
You must be signed in to change notification settings - Fork 924
Implement WASIX context switching API #5881
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
|
LGTM overall. Looks like it should be easy to update this PR with the new async API once that hits, too. |
14da74c to
f6455fc
Compare
af07f08 to
b909de9
Compare
99c6d17 to
8317052
Compare
5f1b640 to
663111c
Compare
b57d9ad to
6128879
Compare
|
This needs a test that verifies that returning from a context entrypoint exits with 129 |
d573653 to
f9adac8
Compare
ecccb01 to
067f233
Compare
| } | ||
| loop { | ||
| // Technically, it's an error for a vfork to return from main, but anyway... | ||
| match resume_vfork(&ctx, &mut store, &start, &call_ret) { |
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.
Note: resume_vfork calls main synchronously, which it shouldn't anymore. Specifically, it's not an error to vfork in the presence of coroutines either, it's just fork that shouldn't happen.
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.
resume_vfork will now exit if a context-switching environment was present, as we can't reenter the previous environment.
…is not in a context switching env
68fa78a to
6bc297e
Compare
a4ae07f to
e6e7265
Compare
WASIX context switching API
This PR implements an API for context switching (aka, greenthreads, stackswitching, fibers, ...) in WASIX.
Goal
Provide minimal stack-switching primitives in WASIX that enable implementing greenthreads.
Motivation
We need some sort of context switching to implement greenlet. We need greenlet because it is a dependency of many other Python packages. To this end, we propose a WASIX context switching API that our greenlet implementation can use to switch between stacks.
C API
This is the proposed C API (WIP)