42_Philosopher/philo/data.h

37 lines
1.3 KiB
C
Raw Normal View History

2023-04-27 08:05:14 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* data.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/27 11:33:06 by cchauvet #+# #+# */
/* Updated: 2023/04/27 11:33:06 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
2023-04-25 10:31:12 -04:00
#ifndef DATA_H
# define DATA_H
# include <pthread.h>
# include <sys/types.h>
typedef struct s_data
{
size_t eat_time;
size_t sleep_time;
size_t life_expectency;
size_t nb_philos;
2023-04-25 10:50:01 -04:00
size_t nb_meals;
2023-04-25 10:31:12 -04:00
void **philos;
pthread_t *threads;
pthread_mutex_t *forks;
pthread_mutex_t stop_mutex;
bool stop;
pthread_mutex_t print_mutex;
} t_data;
2023-04-13 09:00:39 -04:00
bool data_init(t_data *data);
void data_destroyer(t_data *data);
2023-04-27 08:05:14 -04:00
size_t get_min_meal(t_data *data);
2023-04-25 10:31:12 -04:00
#endif