aboutsummaryrefslogtreecommitdiff
path: root/philo_three/main.c
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/main.c
parent99f67bde096ad84dad5b41bc779ae2ad2d807e6f (diff)
downloadphilosophers-f57ec76fd1be738d7b9d82c1f7548883efa15d0c.tar.gz
philosophers-f57ec76fd1be738d7b9d82c1f7548883efa15d0c.tar.bz2
philosophers-f57ec76fd1be738d7b9d82c1f7548883efa15d0c.zip
Added philo_three draft
Diffstat (limited to 'philo_three/main.c')
-rw-r--r--philo_three/main.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/philo_three/main.c b/philo_three/main.c
deleted file mode 100644
index 5c9b869..0000000
--- a/philo_three/main.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* main.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/02/15 00:45:24 by cacharle #+# #+# */
-/* Updated: 2020/02/15 01:40:26 by cacharle ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include "philo_three.h"
-
-int main(int argc, char **argv)
-{
- t_philo_args philo_args;
- sem_t *forks;
-
- if (!parse_args(&philo_args, argc, argv))
- return (1);
- forks = sem_open("philo_two", O_CREAT, 0700, philo_args.philo_num);
- if (forks == SEM_FAILED)
- return (1);
-
- i = -1;
- while (++i < philo_args.philo_num)
- {
- pid = fork();
- if (pid == -1)
- return (1);
- if (pid == 0)
- {
- child_start(&philo_args);
- return (0);
- }
- }
-
- sem_close(forks);
- sem_unlink("philo_two");
- return (0);
-}