From 3e3ef43b566782137e2fc00ed2d8a90d741eedaf Mon Sep 17 00:00:00 2001 From: Ziad Arafat Date: Wed, 6 Oct 2021 11:06:53 -0600 Subject: [PATCH] refactored some code --- Program2/witharray_shm/witharray_shm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Program2/witharray_shm/witharray_shm.c b/Program2/witharray_shm/witharray_shm.c index 748fc93..373d2a7 100644 --- a/Program2/witharray_shm/witharray_shm.c +++ b/Program2/witharray_shm/witharray_shm.c @@ -26,6 +26,7 @@ using the shared memory get method to allocate - Fixed thread so it has its own array - BUGFIX: Shared memory was not going away because I wasnt calling shmctl I mistakenly tought shmdt was all I needed. + - http://www.csl.mtu.edu/cs4411.ck/www/NOTES/process/shm/shmdt.html - */ @@ -369,11 +370,15 @@ int count3s_parallel_proc() } childcnt++; } + int pid; while (childcnt > 0) { pid = wait(NULL); - if (DEBUG) + + if (DEBUG) { printf("Process 1 PID %d finished\n", pid); + } + childcnt--; }