coio-rs icon indicating copy to clipboard operation
coio-rs copied to clipboard

Migrating a coroutine to another thread may move `!Send` object between threads

Open vorner opened this issue 6 years ago • 1 comments

If I understand it correctly, the coroutines here can move from thread to thread.

Now imagine I have something that is not Send for whatever reason. And I don't mean something like Rc (which could cause havoc if I put it into TLS, but that's another issue), but something like Zero-MQ socket which is promised to crash the whole application if ever touched from a different thread. But it is on the stack, so it passes all compile time checks.

Moving the coroutine to another thread would now cause an UB while the user used only safe Rust.

vorner avatar Dec 23 '17 19:12 vorner

Well, yes, this is a problem.

zonyitoo avatar Dec 24 '17 04:12 zonyitoo