free tous les mallocs
This commit is contained in:
18
philo/exec.c
18
philo/exec.c
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/02/01 18:08:58 by hulamy #+# #+# */
|
||||
/* Updated: 2022/02/01 18:09:01 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/02/02 00:28:14 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -57,15 +57,22 @@ static int eat(t_philo *philo, t_mtx *fork1, t_mtx *fork2)
|
||||
}
|
||||
|
||||
/*
|
||||
if (philo->p_nbr % 2 == 0)
|
||||
usleep(10 * 1000);
|
||||
**
|
||||
** just after the assignation of the two forks :
|
||||
|
||||
if (philo->p_nbr % 2 == 0)
|
||||
{
|
||||
fork1 = &(philo->next->m_fork);
|
||||
fork2 = &(philo->m_fork);
|
||||
}
|
||||
|
||||
** just before the while :
|
||||
|
||||
if (philo->p_nbr % 2 == 0)
|
||||
usleep(10 * 1000);
|
||||
|
||||
** just at the end of the while
|
||||
|
||||
usleep(1 * 1000);
|
||||
*/
|
||||
void *philo_exec(void *arg)
|
||||
{
|
||||
@@ -88,7 +95,6 @@ void *philo_exec(void *arg)
|
||||
action_delay(philo, philo->params->t_slp);
|
||||
if (print_message(philo, B_GREEN, "is thinking"))
|
||||
break ;
|
||||
usleep(1 * 1000);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
@@ -98,7 +104,7 @@ void *philo_exec(void *arg)
|
||||
. .
|
||||
-(1) (2)- -(3) . -(1) -(2) -(3) . -(1) (2)- -(3)
|
||||
. .
|
||||
. .
|
||||
(ms) . .
|
||||
. .
|
||||
0: +-(1)-+ (2)- +-(3)- . +-(1)-+ -(2) +-(3)- . +-(1)-+ (2)- +-(3)-
|
||||
| . | . |
|
||||
|
||||
Reference in New Issue
Block a user