In the problem of producer-consumer, I would like to use LinkedBlockingQueueas a shared buffer.
The player queues the item using the method put(), and the Consumer thread consumes the item in the queue using the method take().
My question is: let's say if the queue is empty and the consumer thread calls the method take(), I know that the thread is blocked until the producer puts the item in the queue. But is there something like maximum block length? Can we safely assume that the consumer flow will be blocked before the call put()?
I heard people say that forever there is nothing like a block. It's true?
source
share