Open nrc opened 6 years ago
In particular, "task" seems to mean something different in 'hello world' c.f., 'polling model'.
This is still an issue. It seems that we sometimes use the term "task" when we simply mean "future". "Task" should probably only refer to futures that are spawned onto the runtime. @carllerche Do you have a better, clearer picture of when it's appropriate to use each term?
Maybe instead of just calling things a "task", we could call them "future spawned as a task"? It is longer though.
I think that just punts the question along. What does it mean to be spawned as a task?
It does... but it at least differentiates between future & task. A task is a unit of execution managed by an executor and it is represented by a Future.
I think of a task as just a spawned future running inside an executor.
Perhaps a good analogy could be threads and closures. Consider:
thread::spawn(|| println!("hello"))
tokio::spawn(lazy(|| { println!("hello"); ok(()) }))
The analogy goes like this:
thread::spawn
= tokio::spawn
"task" is used without definition, and it's a bit confusing what exactly it is - does it have a precise, technical meaning or is it colloquial? Is it the same as a future or a combination of futures or something else?