MikeScott8 Programming Thoughts

My musings, ponderings, and other posts on programming. And maybe gadgets and other nerd stuff.

Task.Status refresher and thanks to Jeremy Clark

Leave a comment

Last month (Sept 2015) at the user group I help run (http://nwvdnug.org) we had the pleasure of Jeremy Clark come out and give a talk on Task, Await and Async programming.

I’ll Get Back to You: Task, Await, and Asynchronous Methods

There’s a lot of confusion about async/await, Task/TPL, and asynchronous and parallel programming in general. So let’s start with the basics and look at how we can consume asynchronous methods using Task and then see how the “await” operator can makes things easier for us. Along the way, we’ll look at continuations, cancellation, and exception handling.

One of the things he covered was something I saw a fellow programmer at work run into. The issue is when a Task completes you have a couple properties “IsFaulted”, “IsCompleted”, and “IsCanceled” and the fact that IsCompleted just means it is done running and this is set to true even if faulted. Therefore you cant use it to tell that the task ran to completion SUCCESSFULLY.

I remembered in the talk this came up and was discussed and way to handle it nicely was given. I could not recall exactly the way Jeremy showed that handled it and went searching for more on his site. I found the following post

http://jeremybytes.blogspot.com/2015/01/task-continuations-checking-isfaulted.html

And reading through that post I found the information I wanted.

Thanks again Jeremy! And if you are near anyplace he speaks (which is LOTS of places) I would go see him. He is a really good presenter and covers his topics in a well organized way and really gets the concepts across well.

Check his site and his upcoming speaking is right on his home page.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s