42_Philosopher/print2.c

33 lines
1.2 KiB
C
Raw Normal View History

2023-04-27 08:05:14 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/27 11:41:14 by cchauvet #+# #+# */
/* Updated: 2023/04/27 11:41:46 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "philo.h"
#include "./time.h"
#include "./utils/utils.h"
void print_died(t_philo *philo)
{
t_data *data;
size_t time;
data = philo->data;
time = get_time();
pthread_mutex_lock(&data->print_mutex);
ft_putnum(time, 7);
ft_putchar(' ');
ft_putnum(philo->id + 1, 3);
ft_putchar(' ');
ft_putstr("died");
ft_putchar('\n');
pthread_mutex_unlock(&data->print_mutex);
}