The bugs where introduced in commit
c091d1d.
One bug was that not setting the optional argument
number_of_times_each_philosopher_must_eat behaved the same
as setting it to 0.
The other bug was caused by not initializing a value.
This caused the non-philosopher thread to sleep for much too long.
/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/19 15:53:52 by ljiriste #+# #+# */
-/* Updated: 2024/03/21 10:49:08 by ljiriste ### ########.fr */
+/* Updated: 2024/03/22 09:22:19 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
size_t i;
i = 0;
+ if (set->min_eats_num == 0)
+ return (0);
while (i < set->philo_count)
{
if (philos[i].times_eaten < set->min_eats_num)
suseconds_t furthest_eaten;
size_t i;
- i = 0;
+ furthest_eaten = philos[0].last_eaten;
+ i = 1;
while (i < set->philo_count)
{
if (furthest_eaten > philos[i].last_eaten)