Vitaly Dilmukhametov

  Home  |   Contact  |   Syndication    |   Login
  18 Posts | 0 Stories | 71 Comments | 0 Trackbacks

News

Archives

Post Categories

data

Today I tell you about BlockingCollection<T>. It’s more complex and more interesting data storage. BlockingCollection<T> is a thread-safe data structure, which is called “blocking”, because it based on following principles: if the collection is empty, and some code try to take an element, the thread, that executes this code, is blocked while any at least one element is not added; if the collection already contains maximum elements, the thread, attempting to add new element, will be blocked ......

.NET 4 contains rich set of tools, that allow to create parallelized code more easy. But when we start processing chunk of data in parallel threads, we need to synchronize these threads, and we need some storage for the results of work. Now exist a big number of methods, solving sync issues, and we can realize in code any of them. But MS Parallel Extensions team already do it, and .NET 4 beta versions include set of thread-safe data structures. They implement some popular types of collections, and ......