aboutsummaryrefslogtreecommitdiff
path: root/philo_one/philo_one.h
blob: 4bf9d14866c4202a7ebc1807561f434844751193 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   philo_one.h                                        :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2019/11/24 06:11:16 by cacharle          #+#    #+#             */
/*   Updated: 2019/11/24 06:55:48 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef PHILO_ONE
# define PHILO_ONE

# include <unistd.h>
# include <sys/time.h>
# include <stdlib.h>

typedef enum
{
	STATE_EATING,
	STATE_THINKING,
	STATE_SLEEPING,
	STATE_TOOK_FORK,
	STATE_DEAD
}	t_philo_state;


typedef struct
{
	int				id;
	t_philo_state	state;
	t_bool			alive;
	int				forks[2];
	int				finished_time;
}	t_philo

void print_state_change(int timestamp, t_philo_state state);

#endif