Showing results for Task Parallel Library - .NET Blog

Dec 15, 2011
Post comments count0
Post likes count0

Awaiting Socket Operations

Stephen Toub - MSFT
Stephen Toub - MSFT

The System.Net.Sockets.Socket class in .NET exposes multiple sets of asynchronous methods that perform the same basic operations but that are exposed with different patterns.The first set follows the APM pattern, where for a synchronous method like Receive, the BeginReceive and EndReceive methods are exposed.  If you want to be able to “...

.NET Parallel Programming
Nov 10, 2011
Post comments count0
Post likes count0

Paper :: TPL Performance Improvements in .NET 4.5

Danny Shih
Danny Shih

We invested a lot of time into making parallel programming “just faster” for .NET 4.5.  You’ve already seen some neat tricks to ConcurrentDictionary.  There’s a lot more to say about improving the performance of the Task Parallel Library, and Joe Hoag has a written an excellent paper on the subject:TPL Performance ...

.NET Parallel Programming
Nov 10, 2011
Post comments count0
Post likes count0

Crafting a Task.TimeoutAfter Method

Joe Hoag
Joe Hoag

Imagine that you have a Task handed to you by a third party, and that you would like to force this Task to complete within a specified time period. However, you cannot alter the “natural” completion path and completion state of the Task, as that may cause problems with other consumers of the Task. So you need a way to obtain a copy or “proxy” of th...

.NET Parallel Programming
Nov 1, 2011
Post comments count0
Post likes count0

Updated Async CTP

Stephen Toub - MSFT
Stephen Toub - MSFT

In April, we released the Async CTP Refresh, and since then we've seen fantastic adoption of the technology.  We've also seen the technology landscape evolve.  Windows Phone 7.5, aka "Mango", was released.  Silverlight 5 has had both a Beta and an RC release.  And there have been multiple patches to Visual Studio and the .NET Fr...

.NET Parallel Programming
Oct 24, 2011
Post comments count0
Post likes count0

When at last you await

Stephen Toub - MSFT
Stephen Toub - MSFT

When you start using async methods heavily, you’ll likely see a particular pattern of composition pop up from time to time.  Its structure is typically either of the form: async Task FooAsync() {     … // some initialization code without awaits      await BarAsync(…); ...

.NET Parallel Programming
Oct 24, 2011
Post comments count0
Post likes count2

Task.Run vs Task.Factory.StartNew

Stephen Toub - MSFT
Stephen Toub - MSFT

In .NET 4, Task.Factory.StartNew was the primary method for scheduling a new task.  Many overloads provided for a highly configurable mechanism, enabling setting options, passing in arbitrary state, enabling cancellation, and even controlling scheduling behaviors.  The flip side of all of this power is complexity.  You need to know w...

.NET Parallel Programming
Oct 2, 2011
Post comments count0
Post likes count0

Keeping Async Methods Alive

Stephen Toub - MSFT
Stephen Toub - MSFT

Consider a type that will print out a message when it’s finalized, and that has a Dispose method which will suppress finalization: class DisplayOnFinalize : IDisposable {     public void Dispose() { GC.SuppressFinalize(this); }     ~DisplayOnFinalize() { Console.WriteLine(“Finalized”); } } Now conside...

.NET Parallel Programming
Oct 2, 2011
Post comments count3
Post likes count1

Don’t Forget To Complete Your Tasks

Stephen Toub - MSFT
Stephen Toub - MSFT

“Don’t forget to complete your tasks.”  That guidance may sound trivial and silly, but I recently saw it as a source of a bug in software written by some very smart folks, and thus thought this would be a good opportunity to remind folks of the imperative.Tasks represent a promise.  If you hand one out, someone else may&...

.NET Parallel Programming
Sep 28, 2011
Post comments count0
Post likes count3

Task Exception Handling in .NET 4.5

Stephen Toub - MSFT
Stephen Toub - MSFT

For the .NET Framework 4.5 Developer Preview, a lot of work has been done to improve the Task Parallel Library (TPL), in terms of functionality, in terms of performance, and in terms of integration with the rest of the .NET Framework.  With all of this work, we’ve strived for a very high compatibility bar, which means your applications t...

.NET Parallel Programming
Sep 27, 2011
Post comments count0
Post likes count0

Updated TPL Dataflow CTP

Stephen Toub - MSFT
Stephen Toub - MSFT

It’s been a few months since April when we last released a Community Technology Preview (CTP) of System.Threading.Tasks.Dataflow.dll, aka “TPL Dataflow”.  Today for your programming pleasure, we have another update.As mentioned in “What’s New for Parallelism in .NET 4.5”, System.Threading.Tasks.Dataflow.dll ...

.NET Parallel Programming