Example2 Fix
public synchronized void setData(int val) {
while (!writeable) {
try { wait();}
catch (InterruptedException e) {
System.err.println(“Exception “ + e);
}
}
Data = val;
writeable = false;
notify();
}
Previous slide
Next slide
Back to first slide
View graphic version