diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-10-01 09:36:07 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-10-01 09:36:07 +0200 |
| commit | a237321ee53f44793ebc8b9db26b743f092b5e40 (patch) | |
| tree | 2e983b03826f41bf64af16d3665b12d74a121fa1 /philo_three/src/philo_three.h | |
| parent | f57ec76fd1be738d7b9d82c1f7548883efa15d0c (diff) | |
| download | philosophers-a237321ee53f44793ebc8b9db26b743f092b5e40.tar.gz philosophers-a237321ee53f44793ebc8b9db26b743f092b5e40.tar.bz2 philosophers-a237321ee53f44793ebc8b9db26b743f092b5e40.zip | |
Fixing philo_three working
Diffstat (limited to 'philo_three/src/philo_three.h')
| -rw-r--r-- | philo_three/src/philo_three.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/philo_three/src/philo_three.h b/philo_three/src/philo_three.h index 97882d0..c0afe78 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: 2020/09/30 14:47:49 by cacharle ### ########.fr */ +/* Updated: 2020/10/01 09:10:30 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,6 +15,7 @@ # include <unistd.h> # include <stdlib.h> +# include <signal.h> # include <sys/time.h> # include <semaphore.h> @@ -22,19 +23,19 @@ # define PHILO_SEM_NAME "semaphore_philo_three" # define PHILO_SEM_STDOUT_NAME "semaphore_philo_three_stdout" -# define PHILO_SEM_ALIVE_NAME "semaphore_philo_three_alive" +# define PHILO_SEM_DEAD_NAME "semaphore_philo_three_dead" typedef struct { - long int philo_num; - t_time timeout_death; - t_time timeout_eat; - t_time timeout_sleep; - long int meal_num; - -} t_philo_conf; - -pid_t child_start(t_philo_args *arg); + t_philo_args *conf; + int id; + t_time time_last_eat; + sem_t *forks; + sem_t *sem_stdout; + sem_t *sem_dead; +} t_philo; + +pid_t child_start(t_philo *arg); void event_take_fork(t_philo *arg); void event_eat(t_philo *arg); |
