philosophers/inc/philo.h
2024-12-23 10:10:43 +01:00

34 lines
700 B
C

#ifndef PHILO_H
# define PHILO_H
# include <pthread.h>
# include <stdio.h>
# include <unistd.h>
# include <stdlib.h>
typedef struct s_rules
{
int time_to_die;
int time_to_eat;
int time_to_sleep;
int nb_must_eat;
pthread_mutex_t *print;
pthread_mutex_t *death;
} t_rules;
typedef struct s_philo
{
pthread_t *pid;
pthread_mutex_t *l_fork;
pthread_mutex_t *r_fork;
int last_meal;
t_rules rules;
} t_philo;
// memset, printf, malloc, free, write,
// usleep, gettimeofday, pthread_create,
// pthread_detach, pthread_join, pthread_mutex_init,
// pthread_mutex_destroy, pthread_mutex_lock,
// pthread_mutex_unlock
#endif