Blog - Title

Browse by Tags

Tagged Content List
  • Blog Post: Performance consideration for Async/Await and MarshalByRefObject

    In the previous " What's New for Parallelism in Visual Studio 2012 RC " blog post, I mentioned briefly that for the .NET 4.5 Release Candidate, StreamReader.ReadLineAsync experienced a significant performance improvement over Beta. There's an intriguing story behind that, one I thought I'd share here...
  • Blog Post: What’s New for Parallelism in Visual Studio 2012 RC

    In September, I blogged about what was new for parallelism and asynchrony in the Visual Studio 2012 Developer Preview, and in February I followed that up with a post on what was new in the Beta. Now that Visual Studio 2012 Release Candidate is out, I want to share a few thoughts on what’s new in...
  • Blog Post: Async Targeting Pack for Visual Studio 11 now available for .NET 4 and Silverlight 5

    We’re happy to announce that you can now download an Async Targeting Pack for Visual Studio 11 that lets you target .NET 4 and Silverlight 5. The included DLLs address the previously discussed issue of the Visual Studio 11 Beta compilers being incompatible with the AsyncCtpLibrary* DLLs from the...
  • Blog Post: Should I expose synchronous wrappers for asynchronous methods?

    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...
  • Blog Post: Are deadlocks still possible with await?

    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...
  • Blog Post: Overriding Stream Asynchrony

    In .NET 4.5 Beta, the Stream class provides multiple virtual methods related to reading and writing: Read, BeginRead / EndRead, ReadAsync Write, BeginWrite / EndWrite, WriteAsync Flush, FlushAsync CopyToAsync As a developer deriving from Stream, it’s helpful to understand what the base implementations...
  • Blog Post: Do I need to dispose of Tasks?

    I get this question a lot: “Task implements IDisposable and exposes a Dispose method.  Does that mean I should dispose of all of my tasks?” Summary Here’s my short answer to this question: “No.  Don’t bother disposing of your tasks.” Here’s my medium-length answer: “No.  Don’t bother disposing...
  • Blog Post: Should I expose asynchronous wrappers for synchronous methods?

    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...
  • Blog Post: Is it ok to use nested Parallel.For loops?

    Every now and then, I get this question: “is it ok to use nested Parallel.For loops?” The short answer is “yes.”  As is often the case, the longer answer is, well, longer. Typically when folks ask this question, they’re concerned about one of two things.  First, they’re concerned that each...
  • Blog Post: Are you using TPL Dataflow? We’d love to know!

    Are you using the new System.Threading.Tasks.Dataflow.dll library, either from its CTP s 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...
  • Blog Post: Implementing a simple ForEachAsync, part 2

    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...
  • Blog Post: Implementing a simple ForEachAsync

    Jon Skeet recently asked me how I might go about implementing the following “asynchronous ForEach” behavior: For each element in an enumerable, run a function that returns a Task<TResult> to represent the completion of processing that element. All of these functions may run asynchronously concurrently...
  • Blog Post: "The Zen of Async" at the MVP Summit 2012

    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.
  • Blog Post: What’s New for Parallelism in .NET 4.5 Beta

    At //BUILD/ in September, we blogged about the wealth of new support available for parallelism in the .NET Framework 4.5 Developer Preview . Since then, we’ve been hard at work on the .NET 4.5 Beta. With the beta just released , here are a few interesting and related things that are new or have...
  • Blog Post: Building Async Coordination Primitives, Part 7: AsyncReaderWriterLock

    In my last past, we looked at building an AsyncLock in terms of an AsyncSemaphore .  In this post, we’ll build a more advanced construct, an asynchronous reader/writer lock. An asynchronous reader/writer lock is more complicated than any of the previous coordination primitives we’ve created. ...
  • Blog Post: Building Async Coordination Primitives, Part 6: AsyncLock

    Last time, we looked at building an AsyncSemaphore .  Here, we’ll look at building support for an async mutual exclusion mechanism that supports scoping via ‘using’. As mentioned in the previous post, semaphores are great for throttling and resource management.  You can give a semaphore an...
  • Blog Post: Building Async Coordination Primitives, Part 5: AsyncSemaphore

    In my last few posts, I covered building an AsyncManualResetEvent , an AsyncAutoResetEvent , an AsyncCountdownEvent , and an AsyncBarrier .  In this post, I’ll cover building an AsyncSemaphore class. Semaphores have a wide range of applicability.  They’re great for throttling, for protected...
  • Blog Post: Building Async Coordination Primitives, Part 4: AsyncBarrier

    Last time, we looked at building an AsyncCountdownEvent .  At the end of the post, I highlighted a common pattern for using such a type, which is for all of the participants to signal and then wait for all of the other participants to signal as well.  This kind of synchronization is typically...
  • Blog Post: Building Async Coordination Primitives, Part 3: AsyncCountdownEvent

    In my last two posts, I discussed building AsyncManualResetEvent and AsyncAutoResetEvent coordination primitives.  In this post, I’ll build on that to create a simple AsyncCountdownEvent. A countdown event is an event that will allow waiters to complete after receiving a particular number of signals...
  • Blog Post: Building Async Coordination Primitives, Part 2: AsyncAutoResetEvent

    In my last post, I discussed building an asynchronous version of a manual-reset event .  This time, we’ll build an asynchronous version of an auto-reset event. A manual-reset event is transitioned to the signaled state when requested to do so (i.e. calling Set()), and then it remains in that state...
  • Blog Post: Building Async Coordination Primitives, Part 1: AsyncManualResetEvent

    The Task-based Async Pattern (TAP) isn’t just about asynchronous operations that you initiate and then asynchronously wait for to complete.  More generally, tasks can be used to represent all sorts of happenings, enabling you to await for any matter of condition to occur.  We can even use Tasks...
  • Blog Post: Potential pitfalls to avoid when passing around async lambdas

    One of the really useful capabilities of the new async methods feature in C# and Visual Basic is the ability to write async lambdas and anonymous methods (from here on in this post, I’ll refer to both of these as async lambdas, since the discussion applies equally to both).  This allows you to easily...
  • Blog Post: When “ExecuteSynchronously” doesn’t execute synchronously

    When creating a task continuation with ContinueWith, developers have the opportunity to provide a TaskContinuationOptions enum value, which could include the TaskContinuationOptions.ExecuteSynchronously flag.  ExecuteSynchronously is a request for an optimization to run the continuation task on...
  • Blog Post: FromAsync(asyncResult, …) vs FromAsync(beginMethod, …)

    The Task Parallel Library (TPL) provides a set of “ FromAsync ” helper methods that create a Task or a Task<TResult> to represent an invocation of an APM method pair, i.e. BeginXx / EndXx.  There are, however, two different flavors among these overloads: ones that accept an IAsyncResult “asyncResult...
  • Blog Post: Await, SynchronizationContext, and Console Apps: Part 2

    Yesterday, I blogged about how you can implement a custom SynchronizationContext in order to pump the continuations used by async methods so that they may be processed on a single, dedicated thread. I also highlighted that this is basically what UI frameworks like Windows Forms and Windows Presentation...
Page 1 of 6 (133 items) 12345»