Thanks to Voo, I got what I needed :
def waitPop() : T =
{
this.synchronized
{
while(isEmpty) wait
pop
}
}
While in push, I added notifyAll
(still in a synchronized
block).
notify
was also working, but with notifyAll
the result appears less deterministic.
Thanks a lot !