Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yabtaour
GitHub Repository: yabtaour/Philosophers-42
Path: blob/master/philo/main.c
882 views
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* main.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: yabtaour <[email protected]> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2022/05/19 22:16:39 by yabtaour #+# #+# */
9
/* Updated: 2022/05/19 22:16:41 by yabtaour ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
#include "philosophers.h"
13
14
int main(int argc, char *argv[])
15
{
16
t_data *data;
17
18
data = (t_data *)malloc(sizeof(t_data));
19
if (!data)
20
return (0);
21
if (argc != 5 && argc != 6)
22
return (1);
23
data->argc = argc;
24
data->argv = argv;
25
if (!ft_parsing(data))
26
return (1);
27
if (!ft_initialize_data(data))
28
return (1);
29
if (!ft_start_mutex(data))
30
return (1);
31
ft_initialize_philosophers(data);
32
if (!ft_create_philosophers(data))
33
return (1);
34
return (0);
35
}
36
37