From 5f86d2de1ceb21b113522e11e5eab4319c4e9388 Mon Sep 17 00:00:00 2001 From: Hugo LAMY Date: Wed, 2 Feb 2022 00:31:51 +0100 Subject: [PATCH] free tous les mallocs --- philo/Makefile | 2 +- philo/exec.c | 18 ++- philo/init.c | 13 +- philo/launch.c | 2 +- philo/main.c | 36 ++++- philo/philo_proto.h | 5 +- philo/race.log | 330 -------------------------------------------- 7 files changed, 61 insertions(+), 345 deletions(-) delete mode 100644 philo/race.log diff --git a/philo/Makefile b/philo/Makefile index d21ba96..80e3b66 100644 --- a/philo/Makefile +++ b/philo/Makefile @@ -2,7 +2,7 @@ NAME = philo CC = clang -CFLAGS = -Wall -Wextra -Werror $(INCLUDES) +CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -g3 VPATH = $(DIR_SRCS) DIR_SRCS = srcs diff --git a/philo/exec.c b/philo/exec.c index 883824a..1bd59a4 100644 --- a/philo/exec.c +++ b/philo/exec.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/02/01 18:08:58 by hulamy #+# #+# */ -/* Updated: 2022/02/01 18:09:01 by hulamy ### ########.fr */ +/* Updated: 2022/02/02 00:28:14 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -57,15 +57,22 @@ static int eat(t_philo *philo, t_mtx *fork1, t_mtx *fork2) } /* - if (philo->p_nbr % 2 == 0) - usleep(10 * 1000); -** +** just after the assignation of the two forks : + if (philo->p_nbr % 2 == 0) { fork1 = &(philo->next->m_fork); fork2 = &(philo->m_fork); } +** just before the while : + + if (philo->p_nbr % 2 == 0) + usleep(10 * 1000); + +** just at the end of the while + + usleep(1 * 1000); */ void *philo_exec(void *arg) { @@ -88,7 +95,6 @@ void *philo_exec(void *arg) action_delay(philo, philo->params->t_slp); if (print_message(philo, B_GREEN, "is thinking")) break ; - usleep(1 * 1000); } return (NULL); } @@ -98,7 +104,7 @@ void *philo_exec(void *arg) . . -(1) (2)- -(3) . -(1) -(2) -(3) . -(1) (2)- -(3) . . - . . +(ms) . . . . 0: +-(1)-+ (2)- +-(3)- . +-(1)-+ -(2) +-(3)- . +-(1)-+ (2)- +-(3)- | . | . | diff --git a/philo/init.c b/philo/init.c index 0a1a185..c4a50ef 100644 --- a/philo/init.c +++ b/philo/init.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/26 15:30:34 by hulamy #+# #+# */ -/* Updated: 2022/01/31 10:20:25 by hulamy ### ########.fr */ +/* Updated: 2022/02/02 00:18:04 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -114,17 +114,20 @@ t_philo *init(int ac, char **av, pthread_t **id) t_params *params; t_global *global; + philo = NULL; + params = NULL; + global = NULL; params = init_params(ac, av); if (params == NULL) return (NULL); global = init_global(); - if (params == NULL) - return (NULL); + if (global == NULL) + return (return_free(params, NULL, NULL)); *id = malloc(sizeof(pthread_t) * params->n_phi); if (*id == NULL) - return (NULL); + return (return_free(params, global, NULL)); philo = init_chain_philo(params, global); if (philo == NULL) - return (NULL); + return (return_free(params, global, *id)); return (philo); } diff --git a/philo/launch.c b/philo/launch.c index 44d496d..faba6eb 100644 --- a/philo/launch.c +++ b/philo/launch.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/26 15:30:49 by hulamy #+# #+# */ -/* Updated: 2022/01/31 09:57:34 by hulamy ### ########.fr */ +/* Updated: 2022/02/01 23:44:28 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/philo/main.c b/philo/main.c index 1a5742d..a261d00 100644 --- a/philo/main.c +++ b/philo/main.c @@ -6,12 +6,44 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/26 15:30:40 by hulamy #+# #+# */ -/* Updated: 2022/01/26 15:32:30 by hulamy ### ########.fr */ +/* Updated: 2022/02/02 00:14:59 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ #include "philo.h" +void *return_free(void *e1, void *e2, void *e3) +{ + if (e1) + free(e1); + if (e2) + free(e2); + if (e3) + free(e3); + return (NULL); +} + +void free_philo(t_philo *philo, int n) +{ + t_philo *tmp; + int i; + + if (philo && philo->params) + free(philo->params); + if (philo && philo->global) + free(philo->global); + i = 1; + while (i <= n && philo) + { + if (i < n) + tmp = philo->next; + free(philo); + if (i < n) + philo = tmp; + i++; + } +} + int main(int ac, char **av) { pthread_t *id; @@ -28,5 +60,7 @@ int main(int ac, char **av) pthread_join(id[i], NULL); i++; } + free_philo(philo, philo->params->n_phi); + free(id); return (0); } diff --git a/philo/philo_proto.h b/philo/philo_proto.h index 0223397..d5cdab7 100644 --- a/philo/philo_proto.h +++ b/philo/philo_proto.h @@ -6,13 +6,16 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/26 15:27:13 by hulamy #+# #+# */ -/* Updated: 2022/01/30 15:13:21 by hulamy ### ########.fr */ +/* Updated: 2022/02/02 00:15:43 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef PHILO_PROTO_H # define PHILO_PROTO_H +// main.c +void *return_free(void *e1, void *e2, void *e3); + // init.c t_philo *init(int ac, char **av, pthread_t **id); diff --git a/philo/race.log b/philo/race.log deleted file mode 100644 index 5d0a061..0000000 --- a/philo/race.log +++ /dev/null @@ -1,330 +0,0 @@ -==69556== Helgrind, a thread error detector -==69556== Copyright (C) 2007-2017, and GNU GPL'd, by OpenWorks LLP et al. -==69556== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info -==69556== Command: ./philo 3 610 200 100 10 -==69556== -==69556== ---Thread-Announcement------------------------------------------ -==69556== -==69556== Thread #3 was created -==69556== at 0x49AE282: clone (clone.S:71) -==69556== by 0x48712EB: create_thread (createthread.c:101) -==69556== by 0x4872E0F: pthread_create@@GLIBC_2.2.5 (pthread_create.c:817) -==69556== by 0x4842917: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40180E: launch (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011FD: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== -==69556== ---------------------------------------------------------------- -==69556== -==69556== Thread #3: lock order "0x4A812D8 before 0x4A811E8" violated -==69556== -==69556== Observed (incorrect) order is: acquisition of lock at 0x4A811E8 -==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x401B7C: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x4872608: start_thread (pthread_create.c:477) -==69556== by 0x49AE292: clone (clone.S:95) -==69556== -==69556== followed by a later acquisition of lock at 0x4A812D8 -==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x401BE3: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x4872608: start_thread (pthread_create.c:477) -==69556== by 0x49AE292: clone (clone.S:95) -==69556== -==69556== Lock at 0x4A812D8 was first observed -==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Address 0x4a812d8 is 24 bytes inside a block of size 176 alloc'd -==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Block was alloc'd by thread #1 -==69556== -==69556== Lock at 0x4A811E8 was first observed -==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Address 0x4a811e8 is 24 bytes inside a block of size 176 alloc'd -==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Block was alloc'd by thread #1 -==69556== -==69556== -==69556== ---Thread-Announcement------------------------------------------ -==69556== -==69556== Thread #2 was created -==69556== at 0x49AE282: clone (clone.S:71) -==69556== by 0x48712EB: create_thread (createthread.c:101) -==69556== by 0x4872E0F: pthread_create@@GLIBC_2.2.5 (pthread_create.c:817) -==69556== by 0x4842917: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40180E: launch (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011FD: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== -==69556== ---------------------------------------------------------------- -==69556== -==69556== Thread #2: lock order "0x4A811E8 before 0x4A813C8" violated -==69556== -==69556== Observed (incorrect) order is: acquisition of lock at 0x4A813C8 -==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x401B7C: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x4872608: start_thread (pthread_create.c:477) -==69556== by 0x49AE292: clone (clone.S:95) -==69556== -==69556== followed by a later acquisition of lock at 0x4A811E8 -==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x401BE3: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x4872608: start_thread (pthread_create.c:477) -==69556== by 0x49AE292: clone (clone.S:95) -==69556== -==69556== Lock at 0x4A811E8 was first observed -==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Address 0x4a811e8 is 24 bytes inside a block of size 176 alloc'd -==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Block was alloc'd by thread #1 -==69556== -==69556== Lock at 0x4A813C8 was first observed -==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Address 0x4a813c8 is 24 bytes inside a block of size 176 alloc'd -==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Block was alloc'd by thread #1 -==69556== -==69556== -==69556== ---Thread-Announcement------------------------------------------ -==69556== -==69556== Thread #4 was created -==69556== at 0x49AE282: clone (clone.S:71) -==69556== by 0x48712EB: create_thread (createthread.c:101) -==69556== by 0x4872E0F: pthread_create@@GLIBC_2.2.5 (pthread_create.c:817) -==69556== by 0x4842917: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40180E: launch (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011FD: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== -==69556== ---------------------------------------------------------------- -==69556== -==69556== Thread #4: lock order "0x4A813C8 before 0x4A812D8" violated -==69556== -==69556== Observed (incorrect) order is: acquisition of lock at 0x4A812D8 -==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x401B7C: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x4872608: start_thread (pthread_create.c:477) -==69556== by 0x49AE292: clone (clone.S:95) -==69556== -==69556== followed by a later acquisition of lock at 0x4A813C8 -==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x401BE3: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x4872608: start_thread (pthread_create.c:477) -==69556== by 0x49AE292: clone (clone.S:95) -==69556== -==69556== Lock at 0x4A813C8 was first observed -==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Address 0x4a813c8 is 24 bytes inside a block of size 176 alloc'd -==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Block was alloc'd by thread #1 -==69556== -==69556== Lock at 0x4A812D8 was first observed -==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Address 0x4a812d8 is 24 bytes inside a block of size 176 alloc'd -==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so) -==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo) -==69556== Block was alloc'd by thread #1 -==69556== -==69556== -1 3 has taken a fork -11 3 has taken a fork -12 3 is eating -26 2 has taken a fork -215 3 is sleeping -216 1 has taken a fork -217 2 has taken a fork -217 2 is eating -316 3 is thinking -419 3 has taken a fork -419 1 has taken a fork -420 1 is eating -420 2 is sleeping -521 2 is thinking -620 2 has taken a fork -621 1 is sleeping -623 3 has taken a fork -623 3 is eating -721 1 is thinking -824 1 has taken a fork -824 3 is sleeping -825 2 has taken a fork -826 2 is eating -925 3 is thinking -1025 2 is sleeping -1026 3 has taken a fork -1026 1 has taken a fork -1027 1 is eating -1126 2 is thinking -1227 2 has taken a fork -1228 3 has taken a fork -1228 3 is eating -1229 1 is sleeping -1329 1 is thinking -1430 1 has taken a fork -1430 2 has taken a fork -1431 2 is eating -1435 3 is sleeping -1535 3 is thinking -1631 3 has taken a fork -1632 1 has taken a fork -1632 1 is eating -1633 2 is sleeping -1733 2 is thinking -1833 2 has taken a fork -1833 1 is sleeping -1834 3 has taken a fork -1834 3 is eating -1934 1 is thinking -2034 1 has taken a fork -2034 3 is sleeping -2035 2 has taken a fork -2035 2 is eating -2134 3 is thinking -2236 3 has taken a fork -2236 1 has taken a fork -2237 1 is eating -2237 2 is sleeping -2337 2 is thinking -2439 2 has taken a fork -2440 3 has taken a fork -2440 3 is eating -2440 1 is sleeping -2541 1 is thinking -2641 1 has taken a fork -2641 2 has taken a fork -2642 2 is eating -2642 3 is sleeping -2742 3 is thinking -2843 1 has taken a fork -2843 1 is eating -2843 3 has taken a fork -2844 2 is sleeping -2944 2 is thinking -3042 2 has taken a fork -3043 3 has taken a fork -3043 3 is eating -3044 1 is sleeping -3144 1 is thinking -3244 1 has taken a fork -3245 3 is sleeping -3245 2 has taken a fork -3246 2 is eating -3345 3 is thinking -3447 3 has taken a fork -3448 1 has taken a fork -3448 1 is eating -3450 2 is sleeping -3550 2 is thinking -3649 2 has taken a fork -3649 3 has taken a fork -3649 3 is eating -3650 1 is sleeping -3751 1 is thinking -3850 3 is sleeping -3851 2 has taken a fork -3851 2 is eating -3852 1 has taken a fork -3951 3 is thinking -4051 3 has taken a fork -4052 1 has taken a fork -4053 1 is eating -4053 2 is sleeping -4154 2 is thinking -4253 2 has taken a fork -4254 3 has taken a fork -4254 3 is eating -4255 1 is sleeping -4355 1 is thinking -4456 1 has taken a fork -4456 3 is sleeping -4456 2 has taken a fork -4457 2 is eating -4556 3 is thinking -4658 3 has taken a fork -4658 2 is sleeping -4658 1 has taken a fork -4658 1 is eating -4758 2 is thinking -4859 2 has taken a fork -4859 3 has taken a fork -4859 3 is eating -4860 1 is sleeping -4961 1 is thinking -5059 1 has taken a fork -5059 2 has taken a fork -5060 2 is eating -5061 3 is sleeping -5161 3 is thinking -5260 3 has taken a fork -5261 2 is sleeping -5262 1 has taken a fork -5262 1 is eating -5361 2 is thinking -5464 1 is sleeping -5465 3 has taken a fork -5465 3 is eating -5466 2 has taken a fork -5565 1 is thinking -5666 1 has taken a fork -5666 2 has taken a fork -5666 2 is eating -5667 3 is sleeping -==69556== -==69556== Use --history-level=approx or =none to gain increased speed, at -==69556== the cost of reduced accuracy of conflicting-access information -==69556== For lists of detected and suppressed errors, rerun with: -s -==69556== ERROR SUMMARY: 28 errors from 3 contexts (suppressed: 60416 from 121)