This commit is contained in:
Danny Jonker 2023-05-24 02:49:07 +02:00
parent d8f7f4ce0f
commit 4e1dd400ec
2 changed files with 4 additions and 5 deletions

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */ /* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */ /* (| | )|_| |_| |> < */
/* Created: 2023/03/11 06:42:31 by houtworm /'\_ _/`\__|\__,_/_/\_\ */ /* Created: 2023/03/11 06:42:31 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/05/24 01:08:23 by djonker \___)=(___/ */ /* Updated: 2023/05/24 02:43:39 by djonker \___)=(___/ */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -81,10 +81,10 @@ int ft_liveordie(t_strct *stct, int i)
if (ft_time() - stct->philo[i].lastfood > stct->dietime) if (ft_time() - stct->philo[i].lastfood > stct->dietime)
{ {
pthread_mutex_unlock(&stct->drlastfood); pthread_mutex_unlock(&stct->drlastfood);
printf("%lld %d died\n", ft_time() - stct->strtt, stct->philo[i].id);
pthread_mutex_lock(&stct->drdead); pthread_mutex_lock(&stct->drdead);
stct->dead = 1; stct->dead = 1;
pthread_mutex_unlock(&stct->drdead); pthread_mutex_unlock(&stct->drdead);
printf("%lld %d died\n", ft_time() - stct->strtt, stct->philo[i].id);
return (1); return (1);
} }
else else

View File

@ -6,7 +6,7 @@
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */ /* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
/* (| | )|_| |_| |> < */ /* (| | )|_| |_| |> < */
/* Created: 2023/03/15 02:01:41 by houtworm /'\_ _/`\__|\__,_/_/\_\ */ /* Created: 2023/03/15 02:01:41 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
/* Updated: 2023/05/24 01:09:41 by djonker \___)=(___/ */ /* Updated: 2023/05/24 02:48:50 by djonker \___)=(___/ */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -88,7 +88,6 @@ void ft_aliveprint(t_philo *ps, char *str)
pthread_mutex_unlock(ps->drdead); pthread_mutex_unlock(ps->drdead);
return ; return ;
} }
pthread_mutex_unlock(ps->drdead);
printf("%lld %d %s\n", ft_time() - *ps->strtt, ps->id, str); printf("%lld %d %s\n", ft_time() - *ps->strtt, ps->id, str);
pthread_mutex_unlock(ps->drdead);
} }
// write?