aboutsummaryrefslogtreecommitdiff
path: root/philo_two/philo_two.h
blob: d239e3428a622ce84b0143112e0f12d524ad3845 (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
42
43
44
45
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   philo_two.h                                        :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 22:47:23 by cacharle          #+#    #+#             */
/*   Updated: 2020/02/14 23:55:04 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef PHILO_TWO_H
# define PHILO_TWO_H

# include <pthread.h>
# include <semaphore.h>
# include "common.h"

typedef struct
{
	int				id;
	t_philo_args	*args;
	t_time			time_last_eat;
	sem_t			*forks;
}					t_routine_arg;

/*
** routine.c
*/

void			*routine_philo(void *void_arg);
void			*routine_death(void *void_arg);
t_routine_arg	*routine_args_create(t_philo_args *philo_args, sem_t *forks);

/*
** io.c
*/

void			io_eat(t_routine_arg *arg);
void			io_think(t_routine_arg *arg);
void			io_sleep(t_routine_arg *arg);
void			io_die(t_routine_arg *arg);

#endif