Open bbigras opened 6 years ago
You are correct, that is very poorly worded.
Basically, you need to use TaskExecutor
from a future spawned on tokio::run
. TaskExecutor
uses a thread-local variable referencing the "current executor". Until you are running on the tokio runtime (with tokio::run
) that thread-local is not set.
Does that make sense?
Yes it does, thanks!
Great. This issue can be closed once the API docs have been updated.
Great. This issue can be closed once the API docs have been updated.
It would be good to have some theroy guide or reference regardless of code and language.
https://docs.rs/tokio/0.1.11/tokio/runtime/current_thread/struct.TaskExecutor.html#method.current
I'm confused by the "within the context of a call to run" part. Does it just mean that I must only call
current()
from code being executed by tokio?