Sunday, May 29, 2011

C# 5: Async from the compilers view

As many may know, one of the main features in the next version of C#, C# 5, is the new keywords, async and wait. But how does the compiler handle these new keywords? After all they're only syntactic sugar.
Jon Skeet has an excellent blog series called Eduasync about this, so far it consists of 8 parts, and are definitely recommended reading, if you are interested in the internals of the asynchronous functionality.
Eduasync part 1: introduction
Eduasync part 2: the shape of the caller / async method boundary
Eduasync part 3: the shape of the async method / awaitable boundary
Eduasync part 4: Filling in AsyncTaskMethodBuilder
Eduasync part 5: making Task awaitable
Eduasync part 6: using the infrastructure manually
Eduasync part 7: generated code from a simple async method
Eduasync part 8: generated code from a complex async method
The Async CTP are available from MSDN for everyone to try.

Update
Eduasync part 9: generated code for multiple awaits

No comments:

Post a Comment