possible race conflicts resolut

This commit is contained in:
hugogogo
2022-01-30 15:53:45 +01:00
parent d9142b9af6
commit 7dc4c5a84f
7 changed files with 245 additions and 11 deletions

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/26 15:27:13 by hulamy #+# #+# */
/* Updated: 2022/01/26 17:50:11 by hulamy ### ########.fr */
/* Updated: 2022/01/30 15:13:21 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -25,7 +25,7 @@ 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 *new);
int diff_time(t_philo *philo, struct timeval *new);
int print_message(t_philo *philo, char *clr, char *msg);
// utils.c

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/26 15:27:23 by hulamy #+# #+# */
/* Updated: 2022/01/26 15:29:09 by hulamy ### ########.fr */
/* Updated: 2022/01/30 15:47:58 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -36,6 +36,8 @@ typedef struct s_global
int satiated_count;
t_time t_start;
t_mtx m_print;
t_mtx m_init_time;
t_mtx m_stop;
} t_global;
typedef struct s_philo
@@ -44,6 +46,8 @@ typedef struct s_philo
t_global *global;
int p_nbr;
t_mtx m_fork;
t_mtx m_time;
t_mtx m_eat;
t_time t_last_meal;
int eat_count;
struct s_philo *next;