From 87cf4f4b6a6092a92440fb81d2300bd0fda78720 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sat, 24 Aug 2019 16:03:17 +0000 Subject: [PATCH] changed chain_to_semaphore() to be more fault resistent --- moo/kernel/System.moo | 2 +- moo/lib/exec.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/moo/kernel/System.moo b/moo/kernel/System.moo index af6db13..39196b0 100644 --- a/moo/kernel/System.moo +++ b/moo/kernel/System.moo @@ -172,7 +172,7 @@ class System(Apex) /* TODO: end redo */ caller terminate. - //(Processor _processById: 1) resume. <---- i shouldn't do ths. but, this system causes VM assertion failure. fix it.... + (Processor _processById: 1) resume. //<---- i shouldn't do ths. but, this system causes VM assertion failure. fix it.... System logNl: '>>>>End of OS signal handler process ' & (thisProcess id) asString. ]. diff --git a/moo/lib/exec.c b/moo/lib/exec.c index 9ee4d0d..331d462 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -537,6 +537,8 @@ static MOO_INLINE void chain_into_semaphore (moo_t* moo, moo_oop_process_t proc, /* a process chained to a semaphore cannot get chained to * a semaphore again. a process can get chained to a single semaphore * or a single semaphore group only */ + if ((moo_oop_t)proc->sem != moo->_nil) return; /* ignore it if it happens anyway. TODO: is it desirable???? */ + MOO_ASSERT (moo, (moo_oop_t)proc->sem == moo->_nil); MOO_ASSERT (moo, (moo_oop_t)proc->sem_wait.prev == moo->_nil); MOO_ASSERT (moo, (moo_oop_t)proc->sem_wait.next == moo->_nil);