Using PLINQ for Managing Multiple Threads

I’m currently watching an online video (400 level, very high) from PDC while flying home from Chicago (and blogging about it).  One of the common patterns I often implement is to write some code that does a bunch of “Thread.Start” type stuff and “Thread.IsAlive”.

http://microsoftpdc.com/Sessions/FT21

With PLINQ, this can be avoided with clean error free code (as long as my method is thread safe).  Here is some simple code that demonstrates this.

var result =
source.AsParallel().Where
  (x => [some condition]).Select(x => [something]);

My understanding is that this will just do my [something] in parallel using as many threads as can be allocated, and when one finishes, the next will just start.

Very Cool, Very Clean!

Another good article is here:  http://www.danielmoth.com/Blog/2009/01/plinq.html 

uh oh, they are telling me to turn off all electronic devices, time to land.

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Comments

  1. give you the separate value in the field of civil and the constructions. This ever blue will give you the best training than any

Follow

Get every new post delivered to your Inbox

Join other followers: