Sunday, February 26, 2006

Concurrency talk by Herb Sutter

If you haven't seen the concurrency talk by Herb Sutter from the 05 PDC then I definately recomend taking a look. The talk focusses mostly on efforts that are going into a future version of Visual Studio. Many of these new features though are abstractions over current threading infrastructure that make it easier to
  1. Write multi-threaded code
  2. Understand and grep for places where concurrency begins and ends

Although it's not as nice as what they are doing, it's possible to backport bits of this technology into your existing code base.

Here's the link

http://microsoft.sitestream.com/...

Monday, February 13, 2006

Back to normal

After a full week of beautiful weather here in Seattle it's back to rain again this morning. Last week was great though since the weather allowed me to get in a lot of cycling without having to dry my clothes every night to get the rain out.

Wednesday, February 08, 2006

New in .NET 2.0 - SynchronizationContext

The class SynchronizationContext is a new addition to the 2.0 framework and fills a much needed void. Part of the problem with the 1.0 framework is that a tool/object/whatever that wanted to do work in the background or recieve background notifications had to be aware of the environment that it existed in.

The most popular example is the Windows Forms model. All properties and methods on any object in the System.Windows.Forms namespace can only be manipulated from the Thread that they were created on. So any tool that was used within a forms application had to take one of 2 routes
  1. Accept some form of synchronization object (like a generic Control) and use that to invoke operations onto the appropriate thread
  2. Generically throw up events and make the caller responsible for threading concerns

Both approaches have their drawbacks and advantages. SynchronizationContext fixes this issue. It lets the application model dictate how events and callbacks should behave with respect to threading.

The two main methods are Post(async) and Send(sync). Both accept a delegate and the application model specific SynchronizationContext will invoke the delegate in the proper thread. By default they are just invoked but this can be overridden. Your code can access the context through the static property "Current".

The windows form model injects it's own SynchronizationContext that will force the delegates to be run on the GUI thread. Now background working code can exist independentyl of it's environment. Environments simply need to setup their own context.

This is a lot like option #2 above except that it's an application wide solution rather than an object specific one.

Rides on the Eastside

Come join us tonight for the weekly ride on the east side of Seattle.

http://www.cascade.org/EandR/Activities_Calendar_RDetail.cfm?eventID=5461

Monday, February 06, 2006

Strange Numbers at Best Buy

Ever noticed that Best Buy has a set of apparently useless numbers above the exit? This blogger has found the reason

http://www.cabel.name/2006/02/retail-secrets-best-buy-wall-numbers.html