Anubis Anubis - 9 months ago 94
C# Question

In what way is a BlockingQueue blocking?

As I understand ithat a BlockingCollection uses a non busy wait which is a notify on new items / callback. So I don't understand how it's a blocking but I think im probably mixing blocked threads and blocked access to shared objects?

Answer Source

This is a great explanation:

https://blogs.msdn.microsoft.com/toub/2006/04/12/blocking-queues/

Essentially, the blocking happens when you try to DeQueue something. EnQueue is thread-safe while DeQueue will block (block the thread calling DeQueue) until there is something there to get.

The nice thing is you don't have to care (nor should you care) about how the blocking is implemented.