Reputation: 171
I understand overlapped IO for things you do through IO, like sending a SQL Query or a HTTP request. So when doing await http.GetAsync(url)
I imagine that the internals has queued an overlapped IO operation and my execution will continue when the ICOP is signalled.
However, when we are running something that is purely compute bound in a thread pool worker thread, like await Task.Run(() => CalculatePrimeNumbersFirst(n))
, is the thread calling Task.Run
actually blocked because there is not actual IOCP registered?
I think that callback I executed in the thread pool with signal the awaiter and continue the execution it self, but I could not find a good explanation about this.
Upvotes: 0
Views: 108
Reputation: 9780
An await Task.Run(() => CpuOperations())
will just pick an idle thread from the pool and execute your delegate from within.
Then, the execution will simply notify the await
's state machine of its completion, and the chosen synchronization context will continue to execute your next line of code.
No actual IO ports will be awaited and/or used.
Upvotes: 4