diff --git a/moo/kernel/test-004.moo b/moo/kernel/test-004.moo index 44a2d0e..2b76f2b 100644 --- a/moo/kernel/test-004.moo +++ b/moo/kernel/test-004.moo @@ -20,7 +20,7 @@ class MyObject(Object) s signal. Processor activeProcess terminate. self.t1 := self.t1 + 20 ] fork. - s wait. + s wait. ^self.t1 } @@ -38,14 +38,15 @@ class MyObject(Object) sg addSemaphore: s3. Processor signal: s1 onInput: 0. - Processor signal: s2 onInput: 0. ## this should raise an exception. - Processor signal: s3 onInput: 0. + ##Processor signal: s2 onInput: 0. ## this should raise an exception. + ##Processor signal: s3 onInput: 0. [ sg wait. ] fork. [ sg wait. ] fork. [ sg wait. ] fork. sg wait. +sg removeSemaphore: s1. } method(#class) main diff --git a/moo/lib/exec.c b/moo/lib/exec.c index e86cd0f..a8e3dd3 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -744,6 +744,7 @@ static moo_oop_process_t signal_semaphore (moo_t* moo, moo_oop_semaphore_t sem) MOO_ASSERT (moo, MOO_OOP_TO_SMOOI(proc->sp) < (moo_ooi_t)(MOO_OBJ_GET_SIZE(proc) - MOO_PROCESS_NAMED_INSTVARS)); proc->slot[MOO_OOP_TO_SMOOI(proc->sp)] = (moo_oop_t)sem; + if (MOO_OOP_TO_SMOOI(sem->io_index) >= 0) moo->sem_io_wait_count--; return proc; } } @@ -5052,7 +5053,6 @@ switch_to_next: static MOO_INLINE int do_return (moo_t* moo, moo_oob_t bcode, moo_oop_t return_value) { - #if 0 /* put the instruction pointer back to the return * instruction (RETURN_RECEIVER or RETURN_RECEIVER)