protection segfault creation zero philosophs + deplacement fichiers dans philo + ajout exeption philo folder dans gitignore
This commit is contained in:
52
philo/headers/philo_struct.h
Normal file
52
philo/headers/philo_struct.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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 struct s_time
|
||||
{
|
||||
long int ts;
|
||||
long int tu;
|
||||
} t_time;
|
||||
|
||||
typedef struct s_params
|
||||
{
|
||||
int n_phi;
|
||||
int t_die;
|
||||
int t_eat;
|
||||
int t_slp;
|
||||
int n_eat;
|
||||
} t_params;
|
||||
|
||||
typedef struct s_global
|
||||
{
|
||||
int stop;
|
||||
int satiated_count;
|
||||
t_time t_start;
|
||||
t_mtx m_print;
|
||||
} t_global;
|
||||
|
||||
typedef struct s_philo
|
||||
{
|
||||
t_params *params;
|
||||
t_global *global;
|
||||
int p_nbr;
|
||||
t_mtx m_fork;
|
||||
t_time t_last_meal;
|
||||
int eat_count;
|
||||
struct s_philo *next;
|
||||
} t_philo;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user