Exemple #1
0
 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();
 }
Exemple #2
0
    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);
    }