Ein Philosoph (im Prinzip)

class Philo implements Runnable {
  private int me;
  String id () { return "Philo-" + me; }
  private Fork left; private Fork right;
  Philo ( int m, Fork l, Fork r ) {
      me = m; left = l; right = r;
  }
  public void run () { 
    while (true) {
      right.take (this); left.take (this);
      right.drop (this); left.drop (this);
    } 
  }
}



Johannes Waldmann 2007-01-23