public Philo(int n, int thinkDelay, int eatDelay, philofork philofork) { this.n = n; this.thinkDelay = thinkDelay; this.eatDelay = eatDelay; this.philofork = philofork; left = n == 0 ? 4 : n - 1; right = (n + 1) % 5; new Thread(new ThreadStart(Run)).Start(); }
public static void Main() { philofork philofork = new philofork(); new Philo(0, 10, 50, philofork); new Philo(1, 20, 40, philofork); new Philo(2, 30, 30, philofork); new Philo(3, 40, 20, philofork); new Philo(4, 50, 10, philofork); }