init mutex broken
This commit is contained in:
@@ -62,7 +62,7 @@ t_philo *init(int ac, char **av, pthread_t **id)
|
||||
{
|
||||
t_philo *philo;
|
||||
t_params *params;
|
||||
t_mtx msg_mtx;
|
||||
t_mtx *m_print;
|
||||
|
||||
params = init_params(ac, av);
|
||||
if (params == NULL)
|
||||
@@ -70,8 +70,10 @@ t_philo *init(int ac, char **av, pthread_t **id)
|
||||
*id = malloc(sizeof(int) * params->n_phi);
|
||||
if (*id == NULL)
|
||||
return (NULL);
|
||||
pthread_mutex_init(&msg_mtx, NULL);
|
||||
philo = init_chain_philo(params, &msg_mtx);
|
||||
m_print = NULL;
|
||||
if (pthread_mutex_init(m_print, NULL) != 0)
|
||||
return (NULL);
|
||||
philo = init_chain_philo(params, m_print);
|
||||
if (philo == NULL)
|
||||
return (NULL);
|
||||
return (philo);
|
||||
|
||||
Reference in New Issue
Block a user