diff options
Diffstat (limited to 'philo_one/src/event.c')
| -rw-r--r-- | philo_one/src/event.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/philo_one/src/event.c b/philo_one/src/event.c index 2a0c302..4abfa67 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/02 10:49:08 by cacharle ### ########.fr */ +/* Updated: 2021/01/03 13:56:42 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,7 +20,7 @@ void event_take_fork(t_philo *arg, pthread_mutex_t *fork) pthread_mutex_lock(&arg->conf->mutex_stdout); if (philo_finished(arg->conf)) return ; - philo_put(arg->id, EVENT_FORK); + philo_put(arg->id, EVENT_FORK, arg->conf->initial_time); pthread_mutex_unlock(&arg->conf->mutex_stdout); } @@ -31,7 +31,7 @@ void event_eat(t_philo *arg) pthread_mutex_lock(&arg->conf->mutex_stdout); if (philo_finished(arg->conf)) return ; - philo_put(arg->id, EVENT_EAT); + philo_put(arg->id, EVENT_EAT, arg->conf->initial_time); pthread_mutex_unlock(&arg->conf->mutex_stdout); usleep(arg->conf->timeout_eat * 1000); } @@ -43,7 +43,7 @@ void event_think(t_philo *arg) pthread_mutex_lock(&arg->conf->mutex_stdout); if (philo_finished(arg->conf)) return ; - philo_put(arg->id, EVENT_THINK); + philo_put(arg->id, EVENT_THINK, arg->conf->initial_time); pthread_mutex_unlock(&arg->conf->mutex_stdout); } @@ -57,7 +57,7 @@ void event_sleep( pthread_mutex_lock(&arg->conf->mutex_stdout); if (philo_finished(arg->conf)) return ; - philo_put(arg->id, EVENT_SLEEP); + philo_put(arg->id, EVENT_SLEEP, arg->conf->initial_time); pthread_mutex_unlock(&arg->conf->mutex_stdout); pthread_mutex_unlock(fork_right); pthread_mutex_unlock(fork_left); @@ -72,6 +72,6 @@ void event_die(t_philo *arg) if (philo_finished(arg->conf)) return ; arg->conf->all_alive = false; - philo_put(arg->id, EVENT_DIE); + philo_put(arg->id, EVENT_DIE, arg->conf->initial_time); pthread_mutex_unlock(&arg->conf->mutex_stdout); } |
