37 lines
1.3 KiB
C
37 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* philo.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/03/08 14:38:14 by cchauvet #+# #+# */
|
|
/* Updated: 2023/04/25 16:41:14 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef PHILO_H
|
|
# define PHILO_H
|
|
# include <pthread.h>
|
|
# include <stdio.h>
|
|
# include <stdbool.h>
|
|
# include <stdlib.h>
|
|
# include "./data.h"
|
|
|
|
typedef struct s_philo
|
|
{
|
|
size_t id;
|
|
pthread_mutex_t nb_meal_mutex;
|
|
size_t nb_meal;
|
|
pthread_mutex_t last_eat_mutex;
|
|
size_t last_eat;
|
|
pthread_mutex_t stop_mutex;
|
|
bool stop;
|
|
t_data *data;
|
|
} t_philo;
|
|
|
|
t_philo *philo_init(t_data *data);
|
|
void philo_destroyer(t_philo *philo);
|
|
void *philo_routine(void *arg);
|
|
#endif
|