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_three/src/event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'philo_three') diff --git a/philo_three/src/event.c b/philo_three/src/event.c index 10f82c4..185147f 100644 --- a/philo_three/src/event.c +++ b/philo_three/src/event.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 21:37:50 by cacharle #+# #+# */ -/* Updated: 2021/01/03 13:51:20 by cacharle ### ########.fr */ +/* Updated: 2021/01/03 16:56:51 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,7 +25,7 @@ void event_eat(t_philo *philo) sem_wait(philo->sem_stdout); philo_put(philo->id, EVENT_EAT, philo->initial_time); sem_post(philo->sem_stdout); - usleep(philo->conf->timeout_eat * 1000); + h_sleep(philo->conf->timeout_eat); } void event_think(t_philo *philo) @@ -42,7 +42,7 @@ void event_sleep(t_philo *philo) sem_post(philo->sem_stdout); sem_post(philo->forks); sem_post(philo->forks); - usleep(philo->conf->timeout_sleep * 1000); + h_sleep(philo->conf->timeout_sleep); } void event_die(t_philo *philo) -- cgit