2
votes
Vote UpVote

Three steps to the blocking collection: [1] Inverse semaphore

The Delphi Geek – In What’s new for the coordination data structures in Beta 2? Joshua Phillips published following algorithm demonstrating a use of BlockingCollection in Parallel Extensions Beta 2. var targetNode = …; var bc = new BlockingCollection<Node>(startingNodes); // since we expect GetConsumingEnumerable to block, limit parallelism to the number of // procs, avoiding too much thread injection var parOpts = new ParallelOptions() { MaxDegreeOfParallelism = Enivronment.ProcessorCount }; Parallel.ForEach(bc.GetConsumingEnumerable(), parOpts, (node,loop) => { ...
Favorite? Off-Topic? gabr @ 2010-01-07 17:57

Statistics

Visits: 346
Votes: 2
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Charles Ardour
knight_killer
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)