Thanks Alice, for providing useful links and information. (agreed CPU-bound example was not a good ex for the question)
I think I am almost getting there building a mental model of async
.
Combining your great description of Future
and Wake
notification:
- Is it safe to assume that the external code/thread will only trigger the
wake()
function of futures and don't touch anything else? I am asking because if there is another thread with access to futures, why can't futures use it to do some work while mother executor is busy with other children? - If events that are supposed to wake up a future are not part of mainstream class of network/file IO, timer,... events then one has to implement their own other thread to send notification for
poll
ing? ortokio
et. al provide utilities for this scenario? - Can one think of a
task
in async rust as collection of some futures plus an executorctx
(which has information about the current thread running the task)?