I think you will find this topic interesting: How is the C # 5.0 asynchronous wait function different from TPL?
In short, await does not run threads.
What he does is simply βsplitβ the code in the place where the line is located, where βexpectβ, and all that line is added as a continuation to the Task .
Pay attention to the task. Please note that you have Factory.StartNew . Thus, in your code, it is Factory, which actually launches the task - and includes placement in some thread, whether it is a user interface or pool or any other task scheduler. This means that a "Task" is usually assigned to some scheduler when fulfilling the wait.
Of course, it does not need to be assigned or started at all. The only important thing is that you need to have a task, in fact.
If the Task is not running - the wait does not bother. He simply joins the sequel, and you will solve this problem later. And assign it to the right scheduler.
source share