Questions tagged [concurrent-collections]

Concurrent Collections are several collection implementations in .Net that support multi-threaded access in a safe and efficient way

Concurrent Collections are several collection implementations in .Net that support multi-threaded access in a safe and efficient way. Some of those collections are ConcurrentQueue, ConcurrentStack, ConcurrentBag.

References

98 questions
0
votes
1 answer

A Blocking Concurrent Collection - Take method that takes an item that supports a condition

I would like to have a concurrent collection which supports a blocking thread-safe Take operation, while the actual item taken is an item that satisfies a condition. Something like: private TheBlockingCollection _myCollection; MyClass…
Liel
  • 2,407
  • 4
  • 20
  • 39
0
votes
2 answers

Using a generic dictionary inside a Task (TPL)

I have the following code: Dictionary responseDictionary = new Dictionary(); List taskList = new List(); foreach (string ID in IDs) { string localID = ID; …
Elad Lachmi
  • 10,406
  • 13
  • 71
  • 133
0
votes
1 answer

A socket gets delayed from queue after awhile

am trying to use Socket.Select in multi-threaded application , and I don't wanna use async socket , so here is my code :- public class Server { private TcpListener m_listener; private IConnectionFactory m_factory; private…
Abanoub
  • 3,623
  • 16
  • 66
  • 104
0
votes
1 answer

Sliding window with 50% overlap with producer/consumer threads

I have the following scenario in Java: 1 producer thread stores event objects into a queue. Blocking it is not an option. It should always just store each element at the end of the queue and exit (so no bounded queues). 1 consumer thread waits for…
Markus
  • 613
  • 1
  • 7
  • 20
0
votes
1 answer

TSQL ADO.NET Incorrect Row Count Returned

In C# .NET 4.0 have a BlockingCollection that is taken from BlockingCollection Sample BC_AddTakeCompleteAdding My problem is that a SQLCommand.ExecuteNonQuery in .NET is returning the wrong row count. The update is on the primary key so should…
paparazzo
  • 44,497
  • 23
  • 105
  • 176
0
votes
3 answers

Message queue in an IRC bot

I am currently writing an IRC bot. I'd like to avoid excess flood, so I decided to create a message queue that would send the next message every X milliseconds, but my attempt failed. Line 43: unset.Add((string)de.Key); throws an OutOfMemory…
Haxton Fale
  • 564
  • 1
  • 4
  • 13
0
votes
0 answers

Safely iterating through a Blocking Collection?

I have the following peice of code: private static void FetchAllDataForAllNodesInCache() { var tasksList = Cache.TreeNodeItemsCollection.Select(nodeToEnrich => new Task(() => InsertQueuesIntoNode(nodeToEnrich))).ToList(); …
IbrarMumtaz
  • 4,235
  • 7
  • 44
  • 63
-1
votes
1 answer

Why the TryPopRange may give exceptions? ConcurrentStack

i found a double standarts in TryPopRange ConcurrentStack methods. The name of method TryPopRange says, that it uses the TryXXX pattern, which shouldn't give you exceptions. But TryPopRange method can throw you 3 differents exceptions (ArgumentEx,…
Kirch
  • 1
1 2 3 4 5 6
7