Deadlock?

Dieser Ansatz hat Deadlock (ausprobieren):

class Philo {
  void run () {
    while (true) {
      System.out.println (id() + " hat Hunger");
      right.take (this);
      left.take (this);
      System.out.println (id() + " ist satt");
      right.drop (this);
      left.drop (this);
} } }
Wie kann man das verhindern?



Johannes Waldmann 2006-06-27