blockingcollection Questions

2

Why Parallel.ForEach loop exits with OperationCancelledException, while using GetConsumableEnumerable? //outside the function static BlockingCollection<double> _collection = new BlockingColle...

4

Solved

I would like to await on the result of BlockingCollection<T>.Take() asynchronously, so I do not block the thread. Looking for anything like this: var item = await blockingCollection.TakeAsyn...

2

Solved

BlockingCollection contains only methods to add individual items. What if I want to add a collection? Should I just use foreach loop? Why BlockingCollection doesn't contain method to add a collecti...

1

Solved

I observed a strange behavior while experimenting with the Parallel.ForEach method and the BlockingCollection<T> class. Apparently calling the two lines below on a separate thread, is enough ...

4

I have multiple producers and a single consumer. However if there is something in the queue that is not yet consumed a producer should not queue it again. (unique no duplicates blocking collection ...

2

I have a concurrent BlockingCollection with repeated elements. How can modify it to add or get distinct elements?

1

Solved

I tried BlockingCollection and ConcurrentDictionary. It continues by adding BlockingCollection items as soon as the thread is completed, but ConcurrentDictionary is always adding thread order. Is t...
Philippeville asked 24/1, 2023 at 20:19

2

I'm working on project with following workflow : Background service consumme messages from Rabbitmq's queue Background service use background task queue like this and here to process task parallel...
Wherever asked 3/7, 2022 at 13:51

3

I try to implement a ConcurrentDictionary by wrapping it in a BlockingCollection but did not seem to be successful. I understand that one variable declarations work with BlockingCollection such as ...

3

I've come up with some code to consume all wating items from a queue. Rather than processing the items 1 by 1, it makes sense to process all waiting items as a set. I've declared my queue like thi...

1

I have a recursive problem where the consumers do some work at each level of a tree, then need to recurse down the tree and perform that same work at the next level. I want to use ConcurrentBag/Blo...
Historiated asked 1/6, 2012 at 14:22

1

I have a bunch of requests to process, and during the processing of those requests, more "sub-requests" can be generated and added to the same blocking collection. The consumers add sub-r...

3

Solved

I have one process generating work and a second process with a BlockingCollection<> that consumes that work. When I close my program, I need my consumer to stop consuming work, but I still ne...
Campus asked 11/11, 2013 at 17:10

5

I'm making use of the (frankly great) BlockingCollection<T> type for a heavily multithreaded, high-performance app. There's a lot of throughput through the collection and on the micro-level i...
Beltane asked 21/1, 2012 at 13:37

3

Solved

I have been trying to get my head around the Blocking Collection and I came across Take() and TryTake() also Add() and TryAdd() I understand that if there are no items to take, Take() will wait ti...
Asseverate asked 17/1, 2018 at 12:20

2

Solved

I am running a thread that has a while(isRunning) { blockingCollection.Take() } First I am setting isRunning to false. Then I call thread.Interrupt which stops the blockingCollection from wa...
Veinlet asked 15/11, 2017 at 14:27

3

Solved

I have a server which communicates with 50 or more devices over TCP LAN. There is a Task.Run for each socket reading message loop. I buffer each message reach into a blocking queue, where each bl...

4

What scenarios is it better to use an ArrayBlockingQueue and when is it better to use a LinkedBlockingQueue? If LinkedBlockingQueue default capacity is equal to MAX Integer, is it really helpful t...
Yee asked 22/8, 2013 at 8:33

2

My program has 3 functions. Each function takes a list of Items and fill certain information. For example class Item { String sku,upc,competitorName; double price; } function F1 takes a List...
Chambers asked 8/9, 2016 at 16:26

1

Solved

What is the difference between solution 1 and 2, _taskQ is BlockingCollection and I am trying to implement a Producer-Consumer scenario. The BlockingCollection uses the default ConcurrentQueue for ...
Simpleminded asked 4/2, 2016 at 16:15

4

Solved

I have a quantifiable & repeatable problem using the Task Parallel Library, BlockingCollection<T>, ConcurrentQueue<T> & GetConsumingEnumerable while trying to create a simple pi...

4

Solved

I have a Download Queue implemented with BlockingCollection<>. Now I want to prioritize some Download once in a while. I thought it might be great to move some elements 'up' the Collection, l...
Catastrophism asked 21/9, 2011 at 15:39

1

Solved

I wrote the following method to batch process a huge CSV file. The idea is to read a chunk of lines from the file into memory, then partition these chunk of lines into batches of fixed size. Once w...

3

Solved

I am adding Background Tasks to a Blocking Collection (added in the Background). I am waiting with Task.WhenAll on a Enumerable returned by GetConsumingEnumerable. My question is: Is the overload...
Imputation asked 25/8, 2014 at 14:48

1

I'm a little bit confused about BlockingConnection and AsyncoreConnection. I want to send some messages to the RabbitMQ queue from a Django app. Is it ok to do that using a global BlockingConnectio...
Tyre asked 30/7, 2014 at 22:29

© 2022 - 2024 — McMap. All rights reserved.