Final
parent
e3154b714d
commit
a0f83a8672
|
@ -52,8 +52,12 @@ public class Philosopher extends Thread implements IPhilosopher {
|
|||
log("left nor right eating");
|
||||
this.eating = true;
|
||||
log("eating");
|
||||
} finally {
|
||||
table.unlock();
|
||||
}
|
||||
Thread.sleep(this.random.nextInt(MAX_EATING_DURATION_MS));
|
||||
|
||||
this.table.lock();
|
||||
try {
|
||||
this.eating = false;
|
||||
this.left.condition.signal();
|
||||
this.right.condition.signal();
|
||||
|
|
Loading…
Reference in New Issue