PPT Slide
synchronized int get(){
while(empty)
try {
wait(); // wait for buffer to fill
} catch(InterruptedException e){ }
empty = true;
notify();
return value;
}
private boolean empty = true;
private int value;
}
Previous slide
Next slide
Back to first slide
View graphic version