clean: remove useless file
This commit is contained in:
parent
6759520714
commit
4f138b78e3
22
data.h
22
data.h
@ -1,5 +1,23 @@
|
|||||||
# include "./struct.h"
|
#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;
|
||||||
|
ssize_t nb_meals;
|
||||||
|
void **philos;
|
||||||
|
pthread_t *threads;
|
||||||
|
pthread_mutex_t *forks;
|
||||||
|
pthread_mutex_t stop_mutex;
|
||||||
|
bool stop;
|
||||||
|
pthread_mutex_t print_mutex;
|
||||||
|
} t_data;
|
||||||
|
|
||||||
bool data_init(t_data *data);
|
bool data_init(t_data *data);
|
||||||
void data_destroyer(t_data *data);
|
void data_destroyer(t_data *data);
|
||||||
|
#endif
|
||||||
|
18
philo.h
18
philo.h
@ -6,17 +6,31 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/03/08 14:38:14 by cchauvet #+# #+# */
|
/* Created: 2023/03/08 14:38:14 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/04/13 12:58:09 by cchauvet ### ########.fr */
|
/* Updated: 2023/04/25 14:05:15 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef PHILO_H
|
||||||
|
# define PHILO_H
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include "./data.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);
|
t_philo *philo_init(t_data *data);
|
||||||
void philo_destroyer(t_philo *philo);
|
void philo_destroyer(t_philo *philo);
|
||||||
void *philo_routine(void *arg);
|
void *philo_routine(void *arg);
|
||||||
|
#endif
|
||||||
|
41
struct.h
41
struct.h
@ -1,41 +0,0 @@
|
|||||||
#ifndef STRUCT_H
|
|
||||||
# define STRUCT_H
|
|
||||||
# include <pthread.h>
|
|
||||||
# include <stddef.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;
|
|
||||||
ssize_t nb_meals;
|
|
||||||
void **philos;
|
|
||||||
pthread_t *threads;
|
|
||||||
pthread_mutex_t forks_mutex;
|
|
||||||
bool *forks;
|
|
||||||
pthread_mutex_t stop_mutex;
|
|
||||||
bool stop;
|
|
||||||
pthread_mutex_t print_mutex;
|
|
||||||
} t_data;
|
|
||||||
|
|
||||||
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 last_sleep_mutex;
|
|
||||||
size_t last_sleep;
|
|
||||||
pthread_mutex_t stop_mutex;
|
|
||||||
bool stop;
|
|
||||||
t_data *data;
|
|
||||||
} t_philo;
|
|
||||||
|
|
||||||
t_philo *philo_create(t_data *data);
|
|
||||||
t_philo *philo_destoyer(t_philo *philo);
|
|
||||||
void *philo_routine(void *arg);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user