ok j'arrette de troll
This commit is contained in:
parent
b0f5095569
commit
6e383ed9d6
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/27 11:44:14 by cchauvet #+# #+# */
|
/* Created: 2023/04/27 11:44:14 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/06/01 14:22:52 by cchauvet ### ########.fr */
|
/* Updated: 2023/06/01 14:23:53 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -65,10 +65,10 @@ bool philo_eat(t_philo *philo, t_data *data)
|
|||||||
if (philo_take_forks(philo, data))
|
if (philo_take_forks(philo, data))
|
||||||
return (1);
|
return (1);
|
||||||
print_eating(philo);
|
print_eating(philo);
|
||||||
usleep(get_time_eat(philo, data) * 1000);
|
|
||||||
pthread_mutex_lock(&philo->last_eat_mutex);
|
pthread_mutex_lock(&philo->last_eat_mutex);
|
||||||
philo->last_eat = get_time();
|
philo->last_eat = get_time();
|
||||||
pthread_mutex_unlock(&philo->last_eat_mutex);
|
pthread_mutex_unlock(&philo->last_eat_mutex);
|
||||||
|
usleep(get_time_eat(philo, data) * 1000);
|
||||||
pthread_mutex_unlock(&data->forks[philo->id]);
|
pthread_mutex_unlock(&data->forks[philo->id]);
|
||||||
pthread_mutex_unlock(&data->forks[(philo->id + 1) % data->nb_philos]);
|
pthread_mutex_unlock(&data->forks[(philo->id + 1) % data->nb_philos]);
|
||||||
if (check(data))
|
if (check(data))
|
||||||
|
Loading…
Reference in New Issue
Block a user