From f6e38aa3145682265c84487fb01ace835c8f17d0 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Sat, 18 Jan 2025 11:21:35 +0100 Subject: Add structs and init --- philo/include/philo.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'philo/include') diff --git a/philo/include/philo.h b/philo/include/philo.h index 1ec9c3d..cfc832e 100644 --- a/philo/include/philo.h +++ b/philo/include/philo.h @@ -6,7 +6,7 @@ /* By: dkaiser [times_must_eat]" +# define ERR_MALLOC "Memory allocation failed" + +typedef struct s_fork +{ + int available; + pthread_mutex_t mutex; +} t_fork; typedef struct s_phdata { @@ -29,6 +36,17 @@ typedef struct s_phdata int time_to_eat; int time_to_sleep; int times_must_eat; + int simulation_running; + t_fork *forks; } t_phdata; +typedef struct s_philo +{ + int id; + int times_eaten; + int is_alive; + pthread_t thread; + t_phdata *data; +} t_philo; + #endif -- cgit v1.2.3