philosophers/philo/src/utils/print_status.c
2025-01-27 14:14:43 +01:00

26 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: o_ :::::: ::: */
/* print_status.c :+: / :+::+: :+: */
/* +:+ > +:++:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
/* +#+ +#+#+ +#++#+ +#+ \o/ */
/* Created: 2025/01/20 14:27:10 by whaffman #+#+# #+#+# #+# #+# | */
/* Updated: 2025/01/27 14:14:07 by whaffman ### ### ### ### / \ */
/* */
/* ************************************************************************** */
#include "philo.h"
void print_status(t_philo *philo, char *status)
{
if (philo->death)
return ;
pthread_mutex_lock(philo->rules->print_lock);
printf("%d %d %s\n",
get_time() - philo->rules->start_time,
philo->id,
status);
pthread_mutex_unlock(philo->rules->print_lock);
}