From 4bbbdaab8f5224b72e19f1186a731eafe11b0a29 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sat, 31 Aug 2019 16:21:40 +0000 Subject: [PATCH] changed to decrement sem_io_wait_count before unchaining in terminate_process() --- moo/lib/exec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/moo/lib/exec.c b/moo/lib/exec.c index 10a070c..aed00e1 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -641,7 +641,7 @@ static void dump_process_info (moo_t* moo, moo_bitmask_t log_mask) MOO_LOG0 (moo, log_mask, ":none"); } - /* dump process IDs waiting for output signaling */ + /* dump process IDs waitingt for output signaling */ MOO_LOG0 (moo, log_mask, ",wpo"); sem = moo->sem_io_tuple[index].sem[MOO_SEMAPHORE_IO_TYPE_OUTPUT]; if (sem) @@ -733,8 +733,6 @@ static void terminate_process (moo_t* moo, moo_oop_process_t proc) if ((moo_oop_t)proc->sem != moo->_nil) { - unchain_from_semaphore (moo, proc); - /* [EXPERIMENTAL] =============================== */ if (MOO_CLASSOF(moo, proc->sem) == moo->_semaphore_group) { @@ -750,10 +748,13 @@ static void terminate_process (moo_t* moo, moo_oop_process_t proc) if (((moo_oop_semaphore_t)proc->sem)->subtype == MOO_SMOOI_TO_OOP(MOO_SEMAPHORE_SUBTYPE_IO)) { MOO_ASSERT (moo, moo->sem_io_wait_count > 0); +MOO_DEBUG1 (moo, "decrementing 44 sem_io_wait_count. IO %zd\n", MOO_OOP_TO_SMOOI(((moo_oop_semaphore_t)proc->sem)->u.io.handle)); moo->sem_io_wait_count--; } } /* =============================== */ + + unchain_from_semaphore (moo, proc); } /* when terminated, clear it from the pid table and set the process id to a negative number */