Showing results for async - .NET Blog

Apr 13, 2012
3
6

Should I expose synchronous wrappers for asynchronous methods?

Stephen Toub - MSFT
Stephen Toub - MSFT

In a previous post Should I expose asynchronous wrappers for synchronous methods?, I discussed “async over sync,” the notion of using synchronous functionality asynchronously and the benefits that doing so may or may not yield. The other direction of “sync over async” is also interesting to explore. Avoid Exposing Synchrono...

.NET Parallel Programming
Apr 12, 2012
12
1

Async/Await FAQ

Stephen Toub - MSFT
Stephen Toub - MSFT

From time to time, I receive questions from developers which highlight either a need for more information about the new “async” and “await” keywords in C# and Visual Basic. I’ve been cataloguing these questions, and I thought I’d take this opportunity to share my answers to them.Conceptual Overviewhttps://msdn.co...

.NET Parallel Programming
Apr 12, 2012
0
0

Are deadlocks still possible with await?

Stephen Toub - MSFT
Stephen Toub - MSFT

Developers familiar with parallel programming are also familiar with a wide range of potential problems that can occur when practicing the art.  One of the most well-known issues is “deadlock,” where two or more operations are waiting on each other to complete in a manner such that none of them will be able to complete.I’ve r...

.NET Parallel Programming
Apr 6, 2012
0
0

Overriding Stream Asynchrony

Stephen Toub - MSFT
Stephen Toub - MSFT

In .NET 4.5 Beta, the Stream class provides multiple virtual methods related to reading and writing: As a developer deriving from Stream, it’s helpful to understand what the base implementations do and when you can and should override them.Read, Write, FlushThe Read, Write, and Flush methods are the core synchronous mechanisms...

.NET Parallel Programming
Apr 3, 2012
0
1

Async in 4.5: Worth the Await

Brandon Bray
Brandon Bray

Developers often ask for guidance on how to write responsive user interfaces. Reading most books about the .NET Framework over the past ten years, you’ll see coverage of the asynchronous programming model which requires a lot of careful attention while coding. That’s why the async features in the latest versions of C# and Visual Basic are tremendou...

.NET
Mar 24, 2012
0
3

Should I expose asynchronous wrappers for synchronous methods?

Stephen Toub - MSFT
Stephen Toub - MSFT

Lately I’ve received several questions along the lines of the following, which I typically summarize as “async over sync”: In my library, I have a method “public T Foo();”.  I’m considering exposing an asynchronous method that would simply wrap the synchronous one, e.g. “public Task<T> FooAsync...

.NET Parallel Programming
Mar 6, 2012
0
0

Are you using TPL Dataflow? We’d love to know!

Stephen Toub - MSFT
Stephen Toub - MSFT

Are you using the new System.Threading.Tasks.Dataflow.dll library, either from its CTPs or from the .NET 4.5 Developer Preview or Beta?  We'd love to hear about it, and if you have time, what your experiences have been (good or bad).  What kind of solution are you building, and how are you using TPL Dataflow in it?  Has the library h...

.NET Parallel Programming
Mar 5, 2012
2
2

Implementing a simple ForEachAsync, part 2

Stephen Toub - MSFT
Stephen Toub - MSFT

After my previous post, I received several emails and comments from folks asking why I chose to implement ForEachAsync the way I did.  My goal with that post wasn’t to prescribe a particular approach to iteration, but rather to answer a question I’d received… obviously, however, I didn’t provide enough background. Let ...

.NET Parallel Programming
Mar 4, 2012
0
1

Implementing a simple ForEachAsync

Stephen Toub - MSFT
Stephen Toub - MSFT

Jon Skeet recently asked me how I might go about implementing the following “asynchronous ForEach” behavior: Given what we now know about SemaphoreSlim from my previous post, here’s one way to achieve this: public static Task ForEachAsync<TSource, TResult>(     this IEnumerable<TSource> ...

.NET Parallel Programming
Mar 3, 2012
0
0

“The Zen of Async” at the MVP Summit 2012

Stephen Toub - MSFT
Stephen Toub - MSFT

Thanks to everyone who attended my "The Zen of Async" presentation on Thursday at the MVP Summit.  As I've had several requests, here are the slides and code for the talk. Toub_MVPSummit2012_ZenOfAsync.zip

.NET Parallel Programming