diff --git a/DiningPhilosophers.c b/DiningPhilosophers.c index 9c70d35..06f96d6 100644 --- a/DiningPhilosophers.c +++ b/DiningPhilosophers.c @@ -11,7 +11,7 @@ #define THINKING 0 /*philosopher is thinking*/ #define HUNGRY 1 /*philosopher is trying to get forks*/ #define EATING 2 /*philosopher is eating*/ -pthread_mutex_t mutex; /*mutual exclusion for critical region*/ +// pthread_mutex_t mutex; /*mutual exclusion for critical region*/ typedef struct PhilosopherData { @@ -50,18 +50,15 @@ void Up(); int main(int argc, char* argv[]) { if (argc < 2) - { printf("Too few arguments, exiting...\n"); - return 0; - } if (argc > 2) - { printf("Too many arguments, exiting...\n"); - return 0; + if (argc == 2) + { + int philosopherTotal; + philosopherTotal = GetPhilosopherCount(argv[1]); + PhilosopherInit(philosopherTotal); } - int philosopherTotal; - philosopherTotal = GetPhilosopherCount(argv[1]); - PhilosopherInit(philosopherTotal); return 0; } diff --git a/DiningPhilosophers.out b/DiningPhilosophers.out index fe22f52..e0a0e76 100755 Binary files a/DiningPhilosophers.out and b/DiningPhilosophers.out differ