Browse by Tags

All Tags » async » Eduasync (RSS)

Eduasync 20: Changes between the VS11 Preview and the Visual Studio 11 Beta

A while I ago I blogged about what had changed under the hood of async between the CTP and the VS11 Preview. Well, now that the VS11 Beta is out, it's time to do it all again... Note that the code in this post is in the Eduasync codebase , under a...
Posted by skeet | 8 comment(s)
Filed under: , , ,

Eduasync part 19: ordering by completion, ahead of time...

Today's post involves the MagicOrdering project in source control (project 28). When I wrote part 16 of Eduasync , showing composition in the form of majority voting, one reader mailed me a really interesting suggestion. We don't really need to...
Posted by skeet | 18 comment(s)
Filed under: , , ,

Eduasync part 18: Changes between the Async CTP and the Visual Studio 11 Preview

In preparation for CodeMash, I've been writing some more async code and decompiling it with Reflector. This time I'm using the Visual Studio 11 Developer Preview - the version which installs alongside Visual Studio 2010 under Windows 7. (Don't...
Posted by skeet | 6 comment(s)
Filed under: , , ,

Eduasync part 17: unit testing

In the last post I showed a method to implement "majority voting" for tasks, allowing a result to become available as soon as possible. At the end, I mentioned that I was reasonably confident that it worked because of the unit tests... but I...
Posted by skeet | 6 comment(s)
Filed under: , , ,

Eduasync part 16: Example of composition: majority voting

Note: For the rest of this series, I'll be veering away from the original purpose of the project (investigating what the compiler is up to) in favour of discussing the feature itself. As such, I've added a requirement for AsyncCtpLib.dll - but...
Posted by skeet | 4 comment(s)
Filed under: , ,

Eduasync part 14: Data passing in coroutines

(This post covers project 19 in the source code .) Last time we looked at independent coroutines running in a round-robin fashion. This time we'll keep the round-robin scheduling, but add in the idea of passing data from one coroutine to another....
Posted by skeet | 2 comment(s)
Filed under: , , ,

Eduasync part 13: first look at coroutines with async

(This part covers project 18 in the source code .) As I mentioned in earlier parts, the "awaiting" part of async methods is in no way limited to tasks. So long as we have a suitable GetAwaiter() method which returns a value of a type which in...
Posted by skeet | 14 comment(s)
Filed under: , , , ,

Eduasync part 12: Observing all exceptions

(This post covers projects 16 and 17 in the source code .) Last time we looked at unwrapping an AggregateException when we await a result. While there are potentially other interesting things we could look at with respect to exceptions (particularly around...
Posted by skeet | 10 comment(s)
Filed under: , , ,

Eduasync part 11: More sophisticated (but lossy) exception handling

(This post covers projects 13-15 in the source code .) Long-time readers of this blog may not learn much from this post - it's mostly going over what I've covered before . Still, it's new to Eduasync. Why isn't my exception being caught...
Posted by skeet | 10 comment(s)
Filed under: , , ,

Eduasync part 10: CTP bug - don't combine multiple awaits in one statement...

(This post covers project 12 in the source code .) Last time, we saw what happens when we have multiple await expressions: we end up with multiple potential states in our state machine. That's all fine, but there's a known bug in the current CTP...
Posted by skeet | 7 comment(s)
Filed under: , , ,

Eduasync part 9: generated code for multiple awaits

Last time we looked at a complex async method with nested loops and a single await. This post is the exact opposite - the method is going to look simple, but it will have three await expressions in. If you're glancing down this post and feel put off...
Posted by skeet | 8 comment(s)
Filed under: , , ,

Eduasync part 8: generated code from a complex async method

Last time we had a really simple async method, and looked at the generated code. Even that took a little while... but in this post I'll demonstrate some of the intricacies that get involved when the async method is more complex. In particular, this...
Posted by skeet | 4 comment(s)
Filed under: , , ,

Eduasync part 7: generated code from a simple async method

In part 6 we tried to come up with a "manual" translation of a very simple async method. This time we'll see what the compiler really generates. As a reminder, here's the async method in question: private   static   async Task<...
Posted by skeet | 1 comment(s)
Filed under: , , ,

Eduasync part 6: using the infrastructure manually

Now that we've got the infrastructure for both returning a task from an async method, and awaiting a Task<T>, we're going to look at what the compiler does for us. I always find that the best way of appreciating a feature like this is to...
Posted by skeet | 5 comment(s)
Filed under: , , ,

Eduasync part 5: making Task<T> awaitable

In part 3 we looked at what the C# 5 compiler required for you to "await" something. The sample used a class which actually had an instance method called GetAwaiter, but I mentioned that it could also be an extension method. In this post, we'll...
Posted by skeet | 9 comment(s)
Filed under: , , ,

Eduasync part 4: Filling in AsyncTaskMethodBuilder<T>

In part 2 , I introduced AsyncVoidMethodBuilder, AsyncTaskMethodBuilder and AsyncTaskMethodBuilder<T>. I showed all the signatures , but the implementations were basically trivial and non-functional. Today, I'm going to change all of that.....
Posted by skeet | 7 comment(s)
Filed under: , , ,

Eduasync part 3: the shape of the async method / awaitable boundary

Last time we looked into the boundary between the caller of an async method and the method itself. This time I'm going to show the same sort of "skeleton API" but for awaitable types. This is at the heart of C# 5's async feature: within...
Posted by skeet | 3 comment(s)
Filed under: , , ,

Eduasync part 2: the shape of the caller / async method boundary

For the first few parts of this blog series, we’re not going to write code which actually does anything useful. We’re looking at the API more than the implementation - the bare necessities to get the code to compile. Remember that we’re working without...
Posted by skeet | 6 comment(s)
Filed under: , , ,

Eduasync part 1: introduction

I’ve been waiting to start this blog series for a couple of months. It’s nice to finally get cracking. Hopefully some of you have already read some of my thoughts around C# 5’s async feature , mostly written last year. Since that initial flurry of posts...
Posted by skeet | 8 comment(s)
Filed under: , ,