Skip to content
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

thread safe documentation #73

Open
edfraenkel opened this issue May 5, 2017 · 1 comment
Open

thread safe documentation #73

edfraenkel opened this issue May 5, 2017 · 1 comment

Comments

@edfraenkel
Copy link

The text "Thread-safe: can only resume a coroutine in one thread simultaneously" in the readme.md might scare people away. Is this meant to mean "does not implement send and/or sync yet" or "it is inherently unsafe to use in multiple threads"?

@zonyitoo
Copy link
Contributor

zonyitoo commented May 6, 2017

Specifically, it means "does not implement send and sync yet".

let coro = ...;

thread::spawn(|| {
    coro.resume(); // Resume in thread 1
});

thread::spawn(|| {
    coro.resume(); // Resume in thread 2
});

In this example, you resume the coroutine in two different threads simultaneously.

So in the documentation, I was planned to find a way to prevent users to do this.

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

No branches or pull requests

2 participants