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

194 questions
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
  • 303
  • 2
  • 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
  • 35
  • 5
-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,662
  • 7
  • 23
  • 35
-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
  • 28,708
  • 38
  • 138
  • 232
-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

Blocking Collection shows Duplicate entries

I first retrieve Total number of rows in my table (say 100) and then divide them into chunks (say 25). Then I create a task (taskFetch) which fetches rows from MyTable in chunks into DataTable (each containing 25 records) using Parallel.Foreach()…
Sadiq
  • 720
  • 7
  • 30
-1
votes
1 answer

BlockingCollection Out of Memory Exception

I have a program in which i am getting bitmap images from Camera loading them in blocking collection and processing in a thread. I am calling SetImage from UI thread. It works for few seconds then i run into out of memory exception. Please…
Zshan
  • 26
  • 5
-1
votes
1 answer

Blocking collections + Multiple Worker threads per blocking collection + Wait For Work Completion

I have to do action in batch of 1000 message say Action A, B, C. I can do these actions in parallel. I created groups for them. To increase parallelism, I created subgroups with in each group. Task with in a subgroup needs to be executed serially.…
Rajesh Gaur
  • 267
  • 5
  • 11
-1
votes
1 answer

Should BlockingCollection.TryTake(object,TimeSpan) return immediately on new data?

I am trying to ascertain why performance on my blocking collection appears slow. A simple version of my code is illustrated in the question further below. My question here is if BlockingCollection.TryTake(object,TimeSpan) returns immediately on new…
ManInMoon
  • 6,277
  • 13
  • 57
  • 113
-1
votes
1 answer

Pass multiple parameters to a task

I wish to pass two BlockingCollection<>s to a task. I tried to put them in an object array and pass them but it doesn't work. Can anyone help me with this? The code where i am trying to pass the values is written below: var lineHolders = new[] { …
displayName
  • 12,673
  • 7
  • 50
  • 70
-2
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
  • 533
  • 1
  • 10
-3
votes
1 answer

Inserting user actions to database asynchronously, not producing a lot of thread C#

I'm trying to build this analytical system, this pushes data to the database on specific actions user performs. There will be multiple actions which will need to be logged, hence this needs to be asynchrously done, but it can't spawn off many…
user1393503
  • 275
  • 1
  • 3
  • 10
-3
votes
1 answer

How to prevent task with infinite loop from adding "consecutive" duplicates to blockingcollection?

I have several tasks (in parallel) with an infinite loop. For example, 1, 2, 3, 4, etc. How can I prevent a task like 1 from being consecutively added to my BlockingCollection? Example in my queue: 1213 - good, no consecutive tasks 1123 -…
1 2 3
12
13