From 56afbb3011c346dfc0d9e6d92e76cb13fdb272c8 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Sat, 18 Jan 2025 12:50:55 +0100 Subject: Add ft_log func --- philo/src/simulation.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'philo/src/simulation.c') diff --git a/philo/src/simulation.c b/philo/src/simulation.c index 54ac8e5..3035385 100644 --- a/philo/src/simulation.c +++ b/philo/src/simulation.c @@ -6,7 +6,7 @@ /* By: dkaiser mutex); pthread_mutex_lock(&right_fork->mutex); left_fork->available = 0; + ft_log(philo->id, "has taken a fork"); right_fork->available = 0; - printf("Philo %d is eating\n", philo->id); + ft_log(philo->id, "has taken a fork"); + ft_log(philo->id, "is eating"); usleep(1000000); left_fork->available = 1; right_fork->available = 1; @@ -37,13 +39,13 @@ void philo_eat(t_philo *philo) void philo_sleep(t_philo *philo) { - printf("Philo %d is sleeping\n", philo->id); + ft_log(philo->id, "is sleeping"); usleep(1000000); } void philo_think(t_philo *philo) { - printf("Philo %d is thinking\n", philo->id); + ft_log(philo->id, "is thinking"); } int *process_philo(void *arg) -- cgit v1.2.3