From a69a877b3a2758aafe3de0db87a56063b28ed00f Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Fri, 8 Jan 2021 22:11:19 +0100 Subject: Add sem_grab in philo_two and philo_three to fix philosophers each taking 1 fork --- philo_three/src/philo_three.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'philo_three/src/philo_three.h') diff --git a/philo_three/src/philo_three.h b/philo_three/src/philo_three.h index fe3441b..f2b841d 100644 --- a/philo_three/src/philo_three.h +++ b/philo_three/src/philo_three.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/15 00:46:26 by cacharle #+# #+# */ -/* Updated: 2021/01/04 11:01:18 by cacharle ### ########.fr */ +/* Updated: 2021/01/08 20:25:00 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,6 +27,7 @@ # define PHILO_SEM_STDOUT_NAME "semaphore_philo_three_stdout" # define PHILO_SEM_FINISH_NAME "semaphore_philo_three_finish" # define PHILO_SEM_START_NAME "semaphore_philo_three_start" +# define PHILO_SEM_GRAB_NAME "semaphore_philo_three_grab" typedef struct s_philo { @@ -38,6 +39,7 @@ typedef struct s_philo sem_t *sem_stdout; sem_t *sem_finish; sem_t *sem_start; + sem_t *sem_grab; } t_philo; typedef struct s_sems @@ -46,6 +48,7 @@ typedef struct s_sems sem_t *sem_stdout; sem_t *sem_finish; sem_t *sem_start; + sem_t *sem_grab; } t_sems; pid_t child_start(t_philo *arg); -- cgit