Long standing Case 5959 "Process suspension and Semaphore clash" seems related... https://pharo.fogbugz.com/default.asp?5959 cheers -ben On Fri, Jan 8, 2016 at 10:45 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
I not understand. Is you code is working for you?
This test return nil on my image:
sema := Semaphore new. p:= [ sema waitIfCurtailed: [ r := p suspendingList ] ] fork. 1 seconds wait. p terminate2. "your implementation" r.
And what I try to said is as soon as suspend called on waiting process semaphore is not anymore on it suspendingList.
2016-01-08 15:35 GMT+01:00 Henrik Johansen <henrik.s.johansen@veloxit.no>:
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 do myList := 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 == nil
sema asArray isEmpty
Of 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 == nil list == sema
You should get different answers.
Cheers, Henry