nimp dans timestamp

This commit is contained in:
Hugo LAMY
2022-01-25 18:48:49 +01:00
parent b998de9340
commit d8475537e0
6 changed files with 115 additions and 46 deletions

View File

@@ -12,13 +12,13 @@ t_philo *lst_add_philo(t_params *params, t_global *global, int i)
new->p_nbr = i + 1;
if (pthread_mutex_init(&(new->m_fork), NULL) != 0)
return (NULL);
new->t_last_meal_s = 0;
new->t_last_meal_u = 0;
new->t_last_meal.ts = 0;
new->t_last_meal.tu = 0;
new->eat = 0;
new->next = NULL;
return (new);
}
// looping chained list
t_philo *init_chain_philo(t_params *params, t_global *global)
{
t_philo *philo;
@@ -71,8 +71,8 @@ t_global *init_global(void)
if (!global)
return (NULL);
global->dead = 0;
global->t_start_s = 0;
global->t_start_u = 0;
global->t_start.ts = 0;
global->t_start.tu = 0;
if (pthread_mutex_init(&(global->m_print), NULL) != 0)
return (NULL);
if (pthread_mutex_init(&(global->m_dead), NULL) != 0)