aboutsummaryrefslogtreecommitdiff
path: root/philo_three/src/child.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-01-08 17:57:23 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-01-08 17:57:23 +0100
commit36c5e3a81de8b910bc04a37994b53296c1540353 (patch)
treeed8ff37d914606ba3b4d6921956bd9b29cac0f17 /philo_three/src/child.c
parentad7ed73c124c8fcda6629350307f0f4f41b87fe3 (diff)
downloadphilosophers-36c5e3a81de8b910bc04a37994b53296c1540353.tar.gz
philosophers-36c5e3a81de8b910bc04a37994b53296c1540353.tar.bz2
philosophers-36c5e3a81de8b910bc04a37994b53296c1540353.zip
Added separate thread to flush buffer in philo_one and philo_two
Diffstat (limited to 'philo_three/src/child.c')
-rw-r--r--philo_three/src/child.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/philo_three/src/child.c b/philo_three/src/child.c
index 6060cf7..88a4b7c 100644
--- a/philo_three/src/child.c
+++ b/philo_three/src/child.c
@@ -6,7 +6,7 @@
/* By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/09/30 14:36:16 by cacharle #+# #+# */
-/* Updated: 2021/01/04 11:03:58 by cacharle ### ########.fr */
+/* Updated: 2021/01/08 15:42:02 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -63,10 +63,9 @@ pid_t child_start(t_philo *philo)
philo->sem_start = sem_open(PHILO_SEM_START_NAME, 0);
philo->time_last_eat = h_time_now();
pthread_create(&thread_death, NULL, (t_routine)routine_death, philo);
+ pthread_detach(thread_death);
event_think(philo);
sem_wait(philo->sem_start);
- if (philo->id % 2 == 0)
- usleep(500);
st_child_loop(philo);
exit(0);
}