sema := Semaphore new.p:= [ sema waitIfCurtailed: [ r := p suspendingList ] ] fork.1 seconds wait.p terminate2. "your implementation"r.
On 08 Jan 2016, at 3:24 , Denis Kudriashov <dionisiydk@gmail.com> wrote:2016-01-08 15:17 GMT+01:00 Henrik Johansen <henrik.s.johansen@veloxit.no>:Which is why in terminate I domyList := self suspend.So the semaphore *should* still be the suspendingList, just without the process actually on the list...
I just test it in workspace.sema := Semaphore new.p := [sema wait] fork.p suspend.p suspendingList == nilsema asArray isEmptyOf course, that's something entirely different...if you do what I actually do in the modified terminate;sema := Semaphore new.p := [sema wait ] newProcess.p resume.1 second wait.list := p suspend."this list is (re)assigned to myList in terminate"list == nillist == semaYou should get different answers.Cheers,Henry