PPT Slide
class Buffer {
synchronized void put(int i){
while(!empty)
try {
wait(); // wait previous value to be consumed
} catch(InterruptedException e){}
value = i;
empty = false;
notify();
}
Previous slide
Next slide
Back to first slide
View graphic version