C# 5 async/await thread mechanics feel wrong?

后端 未结 3 1156
终归单人心
终归单人心 2021-02-05 22:10

Why have the calling thread walk into the async method until the inner \'await\'?

Isn\'t it cleaner to just spawn a thread as soon as an async method is called. That way

3条回答
  •  余生分开走
    2021-02-05 23:09

    I like to think of async..await to be syntactic sugar for continuation-passing style programming.

    With that in mind it has nothing to do with threads.

提交回复
热议问题