decremented the waiting count of IO semaphores in a semaphore in a semaphore group is signaled

This commit is contained in:
hyunghwan.chung 2017-11-03 08:10:52 +00:00
parent 7410f09cf5
commit f7272c00fb
2 changed files with 5 additions and 4 deletions

View File

@ -20,7 +20,7 @@ class MyObject(Object)
s signal. s signal.
Processor activeProcess terminate. Processor activeProcess terminate.
self.t1 := self.t1 + 20 ] fork. self.t1 := self.t1 + 20 ] fork.
s wait. s wait.
^self.t1 ^self.t1
} }
@ -38,14 +38,15 @@ class MyObject(Object)
sg addSemaphore: s3. sg addSemaphore: s3.
Processor signal: s1 onInput: 0. Processor signal: s1 onInput: 0.
Processor signal: s2 onInput: 0. ## this should raise an exception. ##Processor signal: s2 onInput: 0. ## this should raise an exception.
Processor signal: s3 onInput: 0. ##Processor signal: s3 onInput: 0.
[ sg wait. ] fork. [ sg wait. ] fork.
[ sg wait. ] fork. [ sg wait. ] fork.
[ sg wait. ] fork. [ sg wait. ] fork.
sg wait. sg wait.
sg removeSemaphore: s1.
} }
method(#class) main method(#class) main

View File

@ -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)); 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; 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; 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) static MOO_INLINE int do_return (moo_t* moo, moo_oob_t bcode, moo_oop_t return_value)
{ {
#if 0 #if 0
/* put the instruction pointer back to the return /* put the instruction pointer back to the return
* instruction (RETURN_RECEIVER or RETURN_RECEIVER) * instruction (RETURN_RECEIVER or RETURN_RECEIVER)