JoinHandleTasks are assumed to run concurrently, potentially by sharing a thread of execution. This means that operations blocking an operating system thread, such as std::thread::sleepor io function from Rust's stdlibrary will stop execution of all tasks sharing this thread Note that blocking the current thread is not in and of itself bad behaviour, just something that does not mix well with the concurrent execution model of async-std. Essentially, never do this:``
fn main() {
task::block_on(async {
// this is std::fs, which blocks
std::fs::read_to_string("test_file");
})
}
Tasks are separate concurrent units and sometimes they need to communicate. That's where Streams come in.