mise a la norme et renommer fonctions
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* philo.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:27:01 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/26 15:27:02 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PHILO_H
|
||||
# define PHILO_H
|
||||
|
||||
# include "libft.h"
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* philo_macro.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:27:08 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/26 15:27:09 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PHILO_MACRO_H
|
||||
# define PHILO_MACRO_H
|
||||
|
||||
|
||||
@@ -1,21 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* philo_proto.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:27:13 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/26 15:29:49 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PHILO_PROTO_H
|
||||
# define PHILO_PROTO_H
|
||||
|
||||
// init.c
|
||||
t_philo *init(int ac, char **av, pthread_t **id);
|
||||
|
||||
// main_thread.c
|
||||
int is_dead(t_philo *philo);
|
||||
// pere_fouettard.c
|
||||
int is_dead(t_philo *philo);
|
||||
void launch_threads(t_philo *philo, pthread_t *id);
|
||||
|
||||
// exec.c
|
||||
void *philo_exec(void *arg);
|
||||
|
||||
// generic.c
|
||||
// utils.c
|
||||
void init_time(t_philo *philo);
|
||||
void update_time(t_philo *philo);
|
||||
int diff_time(t_time old, struct timeval new);
|
||||
int print_message(t_philo *philo, char *clr, char *msg);
|
||||
int diff_time(t_time old, struct timeval new);
|
||||
int print_message(t_philo *philo, char *clr, char *msg);
|
||||
|
||||
// generic.c
|
||||
int ft_atoi(const char *str);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* philo_struct.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:27:23 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/26 15:29:09 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PHILO_STRUCT_H
|
||||
# define PHILO_STRUCT_H
|
||||
|
||||
typedef pthread_mutex_t t_mtx;
|
||||
typedef pthread_mutex_t t_mtx;
|
||||
|
||||
typedef struct s_time
|
||||
{
|
||||
@@ -11,11 +23,11 @@ typedef struct s_time
|
||||
|
||||
typedef struct s_params
|
||||
{
|
||||
int n_phi; // number_of_philosophers
|
||||
int t_die; // time_to_die
|
||||
int t_eat; // time_to_eat
|
||||
int t_slp; // time_to_sleep
|
||||
int n_eat; // [number_of_times_each_philosopher_must_eat]
|
||||
int n_phi;
|
||||
int t_die;
|
||||
int t_eat;
|
||||
int t_slp;
|
||||
int n_eat;
|
||||
} t_params;
|
||||
|
||||
typedef struct s_global
|
||||
|
||||
Reference in New Issue
Block a user