Adjusted main function logic
This commit is contained in:
parent
9522bce20b
commit
86c7c0a3e5
@ -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;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user