aboutsummaryrefslogtreecommitdiff
path: root/philo_one/src/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'philo_one/src/event.c')
-rw-r--r--philo_one/src/event.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/philo_one/src/event.c b/philo_one/src/event.c
index 92ca399..88b9ff1 100644
--- a/philo_one/src/event.c
+++ b/philo_one/src/event.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 21:37:50 by cacharle #+# #+# */
-/* Updated: 2021/01/09 13:12:20 by charles ### ########.fr */
+/* Updated: 2021/01/10 09:55:58 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -28,14 +28,15 @@ void event_eat(t_philo *arg)
{
if (philo_finished(arg->conf))
return ;
+ pthread_mutex_lock(&arg->mutex_eat);
pthread_mutex_lock(&arg->conf->mutex_stdout);
if (philo_finished(arg->conf))
return ;
philo_put(arg->id, EVENT_EAT, arg->conf->initial_time);
pthread_mutex_unlock(&arg->conf->mutex_stdout);
arg->time_last_eat = h_time_now();
+ pthread_mutex_unlock(&arg->mutex_eat);
h_sleep(arg->conf->timeout_eat);
- arg->time_last_eat = h_time_now();
}
void event_think(t_philo *arg)