Replies: 1 comment
-
Have you read this article? It is often useful for obtaining intuition for how async/await works. Other than that, your question is pretty unclear. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to understand Tokio's asynchronous mechanism
How the Wake method works, crate::mem::forget(self); Why does it need to be called at wake and not at pending?
How does single-threaded asynchrony work, and do schedulers and executors also work on the principle of asynchrony?
In Tokio's official teaching, you can see that Spawn sends tasks are used in poll, please ask how asynchronous works at this time
For example
pub async fn asyncF()
{
let a = 0;
let b = 1;
let mut c = 0;
c = a + b;
// funRead is a function to read file
funRead();
}
// call
asyncF.await.unwarp();
In this case, when executing to await, the entire asyncF pending is directly executed or c = a + b is executed first; After pending, if funRead is funRead.await?; And what will it be?
In view of the shallow understanding of individuals, there may be certain mistakes, if there is something that is not in place, please point it out, thank you very much
Beta Was this translation helpful? Give feedback.
All reactions