aboutsummaryrefslogtreecommitdiff
path: root/philo_three/src/philo_three.h
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-30 14:48:12 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-30 14:48:12 +0200
commitf57ec76fd1be738d7b9d82c1f7548883efa15d0c (patch)
tree804162e060808d93324b211111c985d164d9abac /philo_three/src/philo_three.h
parent99f67bde096ad84dad5b41bc779ae2ad2d807e6f (diff)
downloadphilosophers-f57ec76fd1be738d7b9d82c1f7548883efa15d0c.tar.gz
philosophers-f57ec76fd1be738d7b9d82c1f7548883efa15d0c.tar.bz2
philosophers-f57ec76fd1be738d7b9d82c1f7548883efa15d0c.zip
Added philo_three draft
Diffstat (limited to 'philo_three/src/philo_three.h')
-rw-r--r--philo_three/src/philo_three.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/philo_three/src/philo_three.h b/philo_three/src/philo_three.h
new file mode 100644
index 0000000..97882d0
--- /dev/null
+++ b/philo_three/src/philo_three.h
@@ -0,0 +1,45 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* philo_three.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/15 00:46:26 by cacharle #+# #+# */
+/* Updated: 2020/09/30 14:47:49 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef PHILO_THREE_H
+# define PHILO_THREE_H
+
+# include <unistd.h>
+# include <stdlib.h>
+# include <sys/time.h>
+# include <semaphore.h>
+
+# include "common.h"
+
+# 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"
+
+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);
+
+void event_take_fork(t_philo *arg);
+void event_eat(t_philo *arg);
+void event_think(t_philo *arg);
+void event_sleep(t_philo *arg);
+void event_die(t_philo *arg);
+
+#endif