Questions tagged [blockingcollection]

A .Net class that provides blocking and bounding capabilities for thread-safe collections.

A .Net class that provides blocking and bounding capabilities for thread-safe collections.

References

233 questions
0
votes
2 answers

BlockingCollection.GetConsumingEnumerable() blocking on an additional condition

Is it possible to have a BlockingCollection (JobQueue in my example) block execution on both the GetConsumingEnumerable() stream AND on some other criteria? I have the condition availableSlots > 0 which only allows items to be consumed when there…
Dave New
  • 38,496
  • 59
  • 215
  • 394
0
votes
2 answers

Blocking collections operation and structs

I am using a BlockingCollection with a class of type T and I am wondering if I should turn T into a struct. From the BlockingCollection signature in principle I do not see problems with that: [DebuggerDisplay("Count = {Count}, Type =…
Edmondo
  • 19,559
  • 13
  • 62
  • 115
0
votes
1 answer

Removing Elements from BlockingCollection and populating Observable Collection

I have a use-case wherein i want to insert and remove custom object (Stocks) from a blocking collection (larger picture being producer consumer queue). The problem statement is precisely similar to this thread - update an ObservableCollection with…
Patrick
  • 864
  • 1
  • 14
  • 27
0
votes
2 answers

c# wpf Updating UI source from BlockingCollection with Dispatcher

Here's my problem. I'm loading a few BitmapImages in a BlockingCollection public void blockingProducer(BitmapImage imgBSource) { if (!collection.IsAddingCompleted) collection.Add(imgBSource); } the loading happens in…
Probst
  • 17
  • 1
  • 8
0
votes
1 answer

Concurrent collection with buffer and cache

I'm looking for a collection object similar to BlockingCollection that will let me have multiple consumers. However, I need those multiple consumers to consume ALL the items. They cannot remove items from it. Essentially, I need to be able to add…
Jerome Haltom
  • 1,670
  • 2
  • 17
  • 23
0
votes
1 answer

C# Structs and pointers

I have the need to use a blocking collection, so that I can call a delegate asynchronously. Unfortunately the delegate has two parameters consisting of a struct and an additional string. The struct is used because it is the result from a call to an…
weismat
  • 7,195
  • 3
  • 43
  • 58
0
votes
1 answer

How to consume an array of BlockingCollection, one element at a time, in C#?

I've seen lots of examples of how to consume a BlockingCollection in the producer-consumer scenario, even how to consume one element at a time here. I'm quite new to parallel programming though, so I'm facing the following problem: The problem,…
Girardi
  • 2,734
  • 3
  • 35
  • 50
0
votes
1 answer

BlockingCollection having issues with byte arrays

I am having an issue where an object with a byte[20] is being passed into a BlockingCollection on one thread and another thread returning the object with a byte[0] using BlockingCollection.Take(). I think this is a threading issue but I do not know…
MJLaukala
  • 171
  • 1
  • 3
  • 13
0
votes
1 answer

UI Thread gets stuck by using BlockingCollection rapidly?

I am about to write an application that gets streaming data from the TCP port, doing some real time calculations on them. All good so far, but the user interface and the marquee progress bar are getting stuck (for irregular, short time periods) when…
Rome
  • 432
  • 6
  • 27
-1
votes
1 answer

Get count of current active Tasks spawned by a multithreaded application

Hi I am a student intern with little to no C# experience who got put into a situation to take over a windows service that uses TaskCompletionSource and BlockingCollection to implement multithreading. I have never done C#. I am trying to optimize how…
edo101
  • 629
  • 6
  • 17
-1
votes
1 answer

Set a maximum processing of items in a BlockingCollection

I have a blockingcollection of downloads and I would like to have a maximum number of concurrent download I can do, aka a maximum number of concurrent await downloadService.download(release), but the number of items the BlockingCollection should be…
TePi
  • 37
  • 6
-1
votes
1 answer

Multiple consumers update result array inconsistently

I have a large file, each row can be process separately, so I launch one reader, and multiple parsers. The each parser will write result back to a result holder array for further process. I found if I launch more parser, the result holder array…
Benny Ae
  • 1,897
  • 7
  • 25
  • 37
-1
votes
2 answers

Does BlockingCollection re-try if its underlying collection is not empty but TryTake fails?

BlockingCollection is a wrapper around IProducerConsumerCollection. My understanding is that calling BlockingCollection.Take checks if there is an item available (using its own counter). Then it uses TryTake on its underlying collection to retrieve…
mafu
  • 31,798
  • 42
  • 154
  • 247
-1
votes
1 answer

How to bind a BlockingCollection to a WPF Listivew

I am having a BlockingCollection defined in my ViewModel which gets updated on by different threads. I am using this BlockingCollection to populate the ListView. But the newly added item in this collection is not getting reflected on the UI. I need…
-1
votes
1 answer

BlockingCollection TryTake returns false instead of block when the collection is empty

I get back false from BlockingCollection's TryTake method, when the BlockingCollection is empty, although the expected behavior is to block until the collection fills up. Note that the collection is not upper bounded (which should affect the TryAdd…
ilans
  • 2,537
  • 1
  • 28
  • 29
1 2 3
15
16