Compare commits
No commits in common. "cb2e29d18b22ef284fb9f2a6e49691cc83355c5d" and "1461285dbf9285f9471c89ce94ef816680651ebd" have entirely different histories.
cb2e29d18b
...
1461285dbf
1
data.c
1
data.c
@ -49,7 +49,6 @@ void data_destroyer(t_data *data)
|
|||||||
pthread_mutex_unlock(&philo->stop_mutex);
|
pthread_mutex_unlock(&philo->stop_mutex);
|
||||||
if (stop)
|
if (stop)
|
||||||
i++;
|
i++;
|
||||||
usleep(1000);
|
|
||||||
}
|
}
|
||||||
pthread_mutex_destroy(&data->forks_mutex);
|
pthread_mutex_destroy(&data->forks_mutex);
|
||||||
pthread_mutex_destroy(&data->stop_mutex);
|
pthread_mutex_destroy(&data->stop_mutex);
|
||||||
|
6
main.c
6
main.c
@ -43,7 +43,7 @@ void stop(t_data *data)
|
|||||||
pthread_mutex_unlock(&data->stop_mutex);
|
pthread_mutex_unlock(&data->stop_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *check_routine(t_data *data)
|
void check_routine(t_data *data)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
bool ok;
|
bool ok;
|
||||||
@ -55,7 +55,7 @@ void *check_routine(t_data *data)
|
|||||||
{
|
{
|
||||||
stop(data);
|
stop(data);
|
||||||
printf("g pu faim\n");
|
printf("g pu faim\n");
|
||||||
return (NULL);
|
return ;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < data->nb_philos)
|
while (i < data->nb_philos)
|
||||||
@ -68,7 +68,7 @@ void *check_routine(t_data *data)
|
|||||||
{
|
{
|
||||||
print_died(philo);
|
print_died(philo);
|
||||||
stop(data);
|
stop(data);
|
||||||
return (NULL);
|
return ;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
2
print.c
2
print.c
@ -19,7 +19,7 @@ static void print(t_data *data, size_t id, char *str)
|
|||||||
pthread_mutex_unlock(&data->stop_mutex);
|
pthread_mutex_unlock(&data->stop_mutex);
|
||||||
time = get_time();
|
time = get_time();
|
||||||
pthread_mutex_lock(&print_mutex);
|
pthread_mutex_lock(&print_mutex);
|
||||||
printf("%07zu %03zu %s\n", time, id + 1, str);
|
printf("%07zu %3zu %s\n", time, id + 1, str);
|
||||||
pthread_mutex_unlock(&print_mutex);
|
pthread_mutex_unlock(&print_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user