Professional Documents
Culture Documents
CÓDIGO:
using System;
using System.Threading;
namespace cenaComensales
{
class Program
{
static int i = 0;
public static int N = 5;
static int LEFT = (i + N - 1) % N;
static int RIGHT = (i + 1) % N;
const int THINKING = 0;
const int HUNGRY = 1;
const int EATING = 2;
static int[] state = new int[6];
static Semaphore mutex = new Semaphore(1,1);
static Semaphore[] s = new Semaphore[6];
static Thread[] threads = new Thread[6];
}
}
}
}