Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Stephen Toub: Task-Based Asynchrony with Async

Download

Right click “Save as…”

Stephen Toub goes deep into the design and architecture of the new Async features in C# and VB.NET, which rely heavily on .NET’s Task Parallel Library. You can get an early look at this new async programming model, available as the Async CTP, today!

Tags:

Follow the Discussion

  • Kang SuKang Su

    Wow, nice job Stephen (and team)! I'm going to play with this some, but it looks like I can start writing some of our UI in a more readable manner, rather than some of the craziness I'm doing now to keep a responsive UI. 

  • Very informative interview! I watched the other video's on async as well, but this was the best. What came somewhat as a surprise was the introduction of DataFlows, which in the interview appeared as a coincedence because of the CCR talks. So I wonder if we can have an interview on an overview of what this CTP brings us. I mean, we have learned about the basics, and now about DataFlows, but are there any more goodies?

    By the way, as a reassurance: I watched the video to the very end.

    Thanks a lot!

  • @Charles: Watched it till the end and loved every single minute Wink
    Thank you Stephan, Thank you Charles. 

    Unfortunately we have to wait until Visual Studio 2012 right? Of course i can play with the CTP but it would be nice to have it ready for production code right away Smiley

    Another questions: if i use the async/await keywords on the UI-thread it is guaranteed that the code continues on the UI-thread. If i use it on any other thread, does it continue on a thread pool thread? It can't be the same thread that started the operation right?

  • Hi Rodney-

    Regarding which thread things run on, awaiting a task attempts to resume execution in the same threading environment where the operation was suspended.  If there was a current SynchronizationContext when the await began, then execution will resume on that context (by Post'ing to it); otherwise, execution will begin on whatever TaskScheduler was current at the await.  This means that if you await on a UI thread, execution will continue on the UI thread.  If you await on a threadpool thread, you'll resume on a thread pool thread, though not necessarily the same thread that began the await.

  • Thank you Stephen, great work!

    Last week i worked with HttpWebRequest and it looks like this:

    this.webRequest.BeginGetRequestStream(this.OnGetRequestStream, null);
    ...
    private void OnGetRequestStream(IAsyncResult ar)
       this.webRequest.EndGetRequestStream(ar);
       this.webRequest.BeginGetResponse(this.OnGetResponse, null);
    ...
    private void OnGetResponse(IAsyncResult ar)
      this.webRequest.EndGetResponse(ar);
    ...

    Looking forward to async/await Wink

  • Nice video. The stuff about ActionBlock and dataflow programming reminded me of coroutines in Python. Smiley

  • qwertyqwerty

    What about tail recursion in C#5.0? I think tail recursion and async will fit each other very well. Don't they?

  • Koistya `Navinkoistya RIA Guy | Koistya `Navin

    Thanks, Stephen. Great introduction video! That would be good to have some testing project with samples to play with.

  • AvnerAvner

    @koistya: You can download the Async CTP here http://msdn.microsoft.com/en-us/vstudio/async.aspx it contain many samples.

  • Really cool, I liked the way he demonstrated.

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.