-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphilosophers.h
56 lines (49 loc) · 1.61 KB
/
philosophers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* philosophers.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ozahir <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/03 15:12:19 by ozahir #+# #+# */
/* Updated: 2022/06/09 16:03:33 by ozahir ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PHILOSOPHERS_H
#define PHILOSOPHERS_H
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
typedef struct s_mutexes
{
pthread_mutex_t mutex;
pthread_mutex_t print;
int i;
struct s_mutexes *next;
} t_mutexes ;
typedef struct s_philos
{
pthread_t thread;
int n_ph;
long stamp;
long stamp_u;
int rank;
long death;
long eat;
long sleep;
int eating;
t_mutexes *mutexes;
} t_philos ;
int ft_atoi(const char *str);
int input_eval(char **av);
int ft_strlen(const char *s);
int mutexes_destroy(t_philos *philos, int rank);
int philosophers(t_philos *philo);
void *routine(void *i);
void eating(t_philos *philo);
long what_time();
void free_data(t_philos *philos);
#endif