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 said item.
Now of course there has to actually exist an item in the underlying collection (and no external modification happening). But what happens if TryTake
fails for some other reason, and the underlying collection returns false to TryTake
? Does the wrapper just give up, or does it try to take the item again (supposedly succeeding next time)?
The ominous "other reason" could be an internal delay e.g. if the data structure is distributed.