check died dans un autre thread et reorganisation fichiers avec main thread

This commit is contained in:
hugogogo
2022-01-26 10:52:06 +01:00
parent 03633fa5b2
commit 6561340fb9
8 changed files with 75 additions and 59 deletions

View File

@@ -4,15 +4,18 @@
// init.c
t_philo *init(int ac, char **av, pthread_t **id);
// main_thread.c
int diff_time(t_time old, struct timeval new);
int is_dead(t_philo *philo);
void launch_threads(t_philo *philo, pthread_t *id);
// exec.c
void *philo_exec(void *arg);
// generic.c
void init_time(t_philo *philo);
void update_time(t_philo *philo);
int diff_time(t_time old, struct timeval stime);
int is_dead(t_philo *philo, struct timeval stime);
int print_message(t_philo *philo, char *clr, char *msg);
int print_message(t_philo *philo, char *clr, char *msg, int key);
#endif

View File

@@ -21,6 +21,7 @@ typedef struct s_params
typedef struct s_global
{
int dead;
int n_eat;
t_time t_start;
t_mtx m_print;
t_mtx m_dead;