February 21, 2012

Asynchronous Programming with Async/Await

Easier Asynchronous Programming with the New Visual Studio Async

Every time an await is encountered, the currently executing method signs up the rest of the method as the thing to do when the current task is complete, and then immediately returns. Somehow each task will complete itself—either by being scheduled to run as an event on the current thread, or because it used an I/O completion thread or worker thread—and will then cause its continuation to “pick up where it left off” in executing the rest of the method.

Async Programming in Visual Studio 2010

The thing doing that work may be a background thread, an I/O completion thread, a graphic processing unit, or even the current thread. It doesn’t matter to the caller.

Await signifies two related things. First, it says that everything remaining in the method becomes the continuation for the method. A ‘continuation’ represents where the method will continue once the expression being awaited completes its work. Secondly, it tells the method to return.

Pause and Play with Await - How the Await and Async work underneath the covesr and how you can prepare for the m in .NET 4.0.

No comments: