?fix
This commit is contained in:
parent
5c309f2f02
commit
b940b46924
3
data.c
3
data.c
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/27 11:28:36 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/04/27 12:04:31 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/05/05 16:58:45 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -67,6 +67,7 @@ void data_destroyer(t_data *data)
|
||||
i++;
|
||||
usleep(1000);
|
||||
}
|
||||
usleep(1000);
|
||||
i = -1;
|
||||
while (++i < (ssize_t) data->nb_philos)
|
||||
pthread_mutex_destroy(&data->forks[i]);
|
||||
|
4
time.c
4
time.c
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/27 11:35:26 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/02 11:42:45 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/05/02 11:44:21 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -39,7 +39,6 @@ size_t get_time_eat(t_philo *philo, t_data *data)
|
||||
value = (data->life_expectency - philo->last_eat - time);
|
||||
if (value > data->eat_time)
|
||||
value = data->eat_time;
|
||||
// printf("\n%zu: time: %zu, last: %zu, eat: %zu, expectencty: %zu, value: %zu\n", philo->id + 1, time, philo->last_eat, data->eat_time, data->life_expectency, value);
|
||||
return (value);
|
||||
}
|
||||
|
||||
@ -52,7 +51,6 @@ size_t get_time_sleep(t_philo *philo, t_data *data)
|
||||
value = (data->life_expectency - (time - philo->last_eat));
|
||||
if (value > data->sleep_time)
|
||||
value = data->sleep_time;
|
||||
// printf("\n%zu: time: %zu, last: %zu, sleep: %zu, expectencty: %zu, value: %zu\n", philo->id + 1, time, philo->last_eat, data->sleep_time, data->life_expectency, value);
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user