From 7e971b3fa805c40d02ac3e996ab1d181f9584866 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 3 Jan 2021 16:58:00 +0100 Subject: Added h_sleep instead of usleep for better precision --- philo_one/src/event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'philo_one/src/event.c') diff --git a/philo_one/src/event.c b/philo_one/src/event.c index 4abfa67..8ceab65 100644 --- a/philo_one/src/event.c +++ b/philo_one/src/event.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 21:37:50 by cacharle #+# #+# */ -/* Updated: 2021/01/03 13:56:42 by cacharle ### ########.fr */ +/* Updated: 2021/01/03 16:48:00 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -33,7 +33,7 @@ void event_eat(t_philo *arg) return ; philo_put(arg->id, EVENT_EAT, arg->conf->initial_time); pthread_mutex_unlock(&arg->conf->mutex_stdout); - usleep(arg->conf->timeout_eat * 1000); + h_sleep(arg->conf->timeout_eat); } void event_think(t_philo *arg) @@ -61,7 +61,7 @@ void event_sleep( pthread_mutex_unlock(&arg->conf->mutex_stdout); pthread_mutex_unlock(fork_right); pthread_mutex_unlock(fork_left); - usleep(arg->conf->timeout_sleep * 1000); + h_sleep(arg->conf->timeout_sleep); } void event_die(t_philo *arg) -- cgit