fix structure delete int in s_all on time_t

This commit is contained in:
Matthos Denys 2021-05-12 15:48:43 +03:00
parent fb7985cb67
commit 709288b773
7 changed files with 24 additions and 8 deletions

View File

@ -9,13 +9,20 @@
# include <string.h> # include <string.h>
typedef struct s_philo_data
{
pthread_mutex_t *mutex;
} t_philo_data;
typedef struct s_all typedef struct s_all
{ {
int number_of_philosophers; int number_of_philosophers;
int time_to_die; time_t time_to_die;
int time_to_eat; time_t time_to_eat;
int time_to_sleep; time_t time_to_sleep;
int number_of_times_each_philosopher_must_eat; int number_of_times_each_philosopher_must_eat;
t_philo_data *data_philo;
} t_all; } t_all;
void *ft_calloc(size_t num, size_t size); void *ft_calloc(size_t num, size_t size);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,6 +6,7 @@ void *test(char *str)
return(NULL); return(NULL);
} }
int func_test(t_all *all) int func_test(t_all *all)
{ {
pthread_t t0; pthread_t t0;
@ -33,11 +34,19 @@ int func_test(t_all *all)
return (0); return (0);
} }
int prepare_resources(t_all *all)
{
all->data_philo = ft_calloc(sizeof(t_philo_data), 1);
all->data_philo->mutex = (pthread_mutex_t *)ft_calloc(sizeof(pthread_mutex_t), all->number_of_philosophers);
}
int runner(t_all *all, int optional) int runner(t_all *all, int optional)
{ {
if (optional) if (optional)
{ {
func_test(all); // func_test(all);
prepare_resources(all);
return(0); return(0);
} }
else else