diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-01-08 22:11:19 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-01-08 22:11:19 +0100 |
| commit | a69a877b3a2758aafe3de0db87a56063b28ed00f (patch) | |
| tree | 2f0e61aa28cea420fd808fb51eee46ba004d9698 /philo_three/src/philo_three.h | |
| parent | 36c5e3a81de8b910bc04a37994b53296c1540353 (diff) | |
| download | philosophers-a69a877b3a2758aafe3de0db87a56063b28ed00f.tar.gz philosophers-a69a877b3a2758aafe3de0db87a56063b28ed00f.tar.bz2 philosophers-a69a877b3a2758aafe3de0db87a56063b28ed00f.zip | |
Add sem_grab in philo_two and philo_three to fix philosophers each taking 1 fork
Diffstat (limited to 'philo_three/src/philo_three.h')
| -rw-r--r-- | philo_three/src/philo_three.h | 5 |
1 files changed, 4 insertions, 1 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); |
