aboutsummaryrefslogtreecommitdiff
path: root/philo_one/philo_one.h
diff options
context:
space:
mode:
Diffstat (limited to 'philo_one/philo_one.h')
-rw-r--r--philo_one/philo_one.h41
1 files changed, 41 insertions, 0 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* 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 <unistd.h>
+# include <sys/time.h>
+# include <stdlib.h>
+
+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