1
0

」 feat: parsing protection working

This commit is contained in:
2024-08-06 19:51:13 +02:00
parent 074ce180b7
commit dde531f8dd
8 changed files with 156 additions and 86 deletions

View File

@ -1,31 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* eat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/30 02:29:39 by adjoly #+# #+# */
/* Updated: 2024/07/31 21:53:13 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "philo.h"
bool eat(t_philo *philo)
{
bool death;
philo->state = FORK_TAKEN;
take_fork(&philo->fork, philo->id);
log_philo(*philo);
if (&(philo->fork.left) == philo->fork.right)
return (true);
take_fork(&philo->fork, philo->id + 1);
log_philo(*philo);
philo->state = EAT;
gettimeofday(&(philo->eat), NULL);
log_philo(*philo);
death = sleep_phil(*philo);
return (death);
}