Can anyone tell me what might be wrong with this code? It's supposed to be a single-element queue, with blocking put and get methods. It seems to work just fine "most of the time", but on Windows, with two consumers (and one producer) I find that one of the consumer threads, just sometimes, sleeps forever in the wait, apparently never waking up (even if the other consumer
thread is off busy, and not waiting in the get() method).
Yes, I know that I should be using a BlockingQueue for this, but this is a learning exercise, and I'm puzzled how it can fail like this. What (probably obvious!) did I miss?
TIA,
Toby