From 34058c2901f18fd11a6e50e9fa8e3faefdcc6c7b Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 24 Nov 2019 07:08:16 +0100 Subject: Initial commit --- philo_one/philo_one.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 philo_one/philo_one.h (limited to 'philo_one/philo_one.h') diff --git a/philo_one/philo_one.h b/philo_one/philo_one.h new file mode 100644 index 0000000..4bf9d14 --- /dev/null +++ b/philo_one/philo_one.h @@ -0,0 +1,41 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* philo_one.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/11/24 06:11:16 by cacharle #+# #+# */ +/* Updated: 2019/11/24 06:55:48 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef PHILO_ONE +# define PHILO_ONE + +# include +# include +# include + +typedef enum +{ + STATE_EATING, + STATE_THINKING, + STATE_SLEEPING, + STATE_TOOK_FORK, + STATE_DEAD +} t_philo_state; + + +typedef struct +{ + int id; + t_philo_state state; + t_bool alive; + int forks[2]; + int finished_time; +} t_philo + +void print_state_change(int timestamp, t_philo_state state); + +#endif -- cgit