C# async/await: how main thread knows that awaited function is completed and can resume the work ?

sravan kumar 121 Reputation points
2021-04-04T19:41:56.217+00:00

Hi,

I'm trying to deep dive into the concept of async programming and need some help in understanding the same.

what I know : When control hits await func, it gives the execution work to pool thread and main thread gets free.

Query : how main thread knows that pool thread completed the async task ? is that main thread keeps checking the worker thread if task completed or not ?

note: i believe, pool thread / worker thread / background thread all are same.

Thanks,
Sravan kumar

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,248 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,119 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,036 Reputation points
    2021-04-04T19:51:59.813+00:00

    There is no one straightforward answer and with that would defer you to this article.

    0 comments No comments