Yes you do, System.Collections.Generic.Queue<T> not thread safe to write and read at the same time. You need to either lock a single object before appearing or decompressing, or if you are using .NET 4 / 4.5, use the System.Collections.Concurrent.ConcurrentQueue<T> class and use the TryDequeue method.
The reason your current implementation has not called you so far is caused by calling Thread.Sleep(500) (not what you should use in production code), which means that prodThread not being written to the queue while consumeThread is consumeThread read from it, since the read operation takes less than 500 ms. If you remove the Thread.Sleep coefficients, this will throw an exception at some point.
source share