Microsoft announced the Visual Studio Async CTP today (October 28, 2010) that introduces the async
and await
keywords into C#/VB for asynchronous m
As I understand it, what the async
and await
keywords do is that every time an async
method employs the await
keyword, the compiler will turn the remainder of the method into a continuation that is scheduled when the async operation is completed. That allows async
methods to return to the caller immediately and resume work when the async part is done.
According to the available papers there are a lot details to it, but unless I am mistaken, that is the gist of it.
As I see it the purpose of the async methods is not to run a lot of code in parallel, but to chop up async methods into a number of small chunks, that can be called as needed. The key point is that the compiler will handle all the complex wiring of callbacks using tasks/continuations. This not only reduces complexity, but allows async method to be written more or less like traditional synchronous code.