Eine Gabel (genauer)

class Fork {
  boolean taken;
  synchronized void drop (Philo p) {
    taken = false;
    notify ();
  }
  synchronized void take (Philo p) {
    while (taken) {
        wait ();
    }
    taken = true;
  }
}



Johannes Waldmann 2008-01-23