aboutsummaryrefslogtreecommitdiff
path: root/common/philo.c
blob: dfc927807c32013f4ea5855d0b554803d6d65cb4 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   philo.c                                            :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/09 01:54:53 by cacharle          #+#    #+#             */
/*   Updated: 2020/02/14 00:29:17 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "common.h"

void				philo_eat(int id, t_time timeout)
{
	philo_put_state_change(id, EVENT_EATING);
	usleep(timeout * 1000);
}

void				philo_sleep(int id, t_time timeout)
{
	philo_put_state_change(id, EVENT_SLEEPING);
	usleep(timeout * 1000);
}

void				philo_think(int id)
{
	philo_put_state_change(id, EVENT_THINKING);
}

void				philo_die(int id)
{
	philo_put_state_change(id, EVENT_DIED);
}