As I understand, when you have an await, the compiler splits your method into two parts, one part before the await and another part after it. The IL will create state machine etc.
The moment await is encountered, the control returns to the main thread; is what I know. As if there were a return keyword. If this is correct/partially correct, then I want to know where is the awaited operation running as the control was returned to main thread. I am not clear about where the awaited operation is running and this is what I'd like to know...
If I have following commands:
code;
code;
await *someLongRunningOperation*;
moreCode;
I want to know where is the someLongRunningOperation running while we await? Does it get a separate thread from thread pool? Is it running on a separate thread/core??? Not sure... Answers appreciated...