-
Notifications
You must be signed in to change notification settings - Fork 0
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
Complete thread-safety #7
Comments
Thread-locals will probably be dealt with by documenting their caveats (and discouraging their use). |
The current implementation passes existing tests, and while I'm pretty sure it'll be thread-safe, I don't yet know how to test this. As there is room for doubt, I am not yet documenting this behaviour. This was started as an effort to clean away the unnecessary activate and deactivate utility functions (in favour of calling _green_current directly). Sort of got out of hand; I wasn't expecting to implement this quite so early. Since there are no tests for this, other architectures/platforms likely won't mimic this capability right away.
This has been implemented early for x86_64, however there are not yet tests guaranteeing this. As such, new platforms may be considered acceptable without mimicking this behaviour. To clarify, the general strategy here is to guarantee that a coroutine can't be resumed twice. The only thing that is changing here is guaranteeing that this cannot happen in a multi-threading context. The only thing that's really needed to assert this, is to make the process of activating a coroutine atomic. Since (due to the atomic activation) it is guaranteed that an await will only ever occur on a single thread at a time for a given coroutine, all that |
Same thing should be implemented in AArch64, too. Again, hard to test this. |
While multiple threads can have their own coroutines, this is not documented, and an individual coroutine is not safe for thread migration.
The text was updated successfully, but these errors were encountered: