The attribute has not been initialized in previous commits.
It has aso not been a part of the philosopher structure...
This has been rectified.
/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/09 09:13:40 by ljiriste #+# #+# */
-/* Updated: 2024/05/12 21:54:46 by ljiriste ### ########.fr */
+/* Updated: 2024/05/24 09:21:50 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
int res;
sem_wait(philo->philo_sem);
- res = philo->lives;
+ res = philo->alive;
sem_post(philo->philo_sem);
return (res);
}
/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/22 11:19:48 by ljiriste #+# #+# */
-/* Updated: 2024/05/12 21:48:59 by ljiriste ### ########.fr */
+/* Updated: 2024/05/24 09:21:34 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
gettimeofday(&settings->start, NULL);
philo.settings = *settings;
philo.id = 1;
+ philo.alive = 1;
while (philo.id <= settings->philo_count)
{
philo_pids[philo.id - 1] = fork();
/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/22 11:10:17 by ljiriste #+# #+# */
-/* Updated: 2024/05/12 21:55:26 by ljiriste ### ########.fr */
+/* Updated: 2024/05/24 09:21:24 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
{
unsigned int num_eaten;
unsigned int id;
+ int alive;
useconds_t last_eaten;
sem_t *semaphores[sem_num];
sem_t *philo_sem;