aboutsummaryrefslogtreecommitdiff
path: root/philo_one
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-12-31 19:22:37 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-12-31 19:22:37 +0100
commit632b7d81d6c7943e5e39812068c77df4681ebed2 (patch)
treed434bbed8f0fb1f8cd04aa0dc5e6dc7fc9701520 /philo_one
parentcf2ef2c3901f3da524079a9ad912dfb99e115a7e (diff)
downloadphilosophers-632b7d81d6c7943e5e39812068c77df4681ebed2.tar.gz
philosophers-632b7d81d6c7943e5e39812068c77df4681ebed2.tar.bz2
philosophers-632b7d81d6c7943e5e39812068c77df4681ebed2.zip
Added usleep in death checking threads
Diffstat (limited to 'philo_one')
-rw-r--r--philo_one/src/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/philo_one/src/main.c b/philo_one/src/main.c
index a9a6a63..0c4b95c 100644
--- a/philo_one/src/main.c
+++ b/philo_one/src/main.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/24 05:53:02 by cacharle #+# #+# */
-/* Updated: 2020/12/30 14:04:42 by charles ### ########.fr */
+/* Updated: 2020/12/31 19:22:08 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -60,9 +60,9 @@ int main(int argc, char **argv)
free(philos);
return (1);
}
- while (conf.all_alive && (conf.meal_num != -1 && conf.meal_num_finished_counter != conf.philo_num))
- /* printf("%ld\n", conf.meal_num_finished_counter); */
- ;
+ while (conf.all_alive)
+ if (conf.meal_num != -1 && conf.meal_num_finished_counter == conf.philo_num)
+ break;
conf.all_alive = false;
philos_detach(philos, conf.philo_num);
forks_destroy(forks, conf.philo_num);