On 05 Jan 2016, at 7:24 , Denis Kudriashov <dionisiydk@gmail.com> wrote:2016-01-05 18:49 GMT+01:00 Henrik Johansen <henrik.s.johansen@veloxit.no>:ifCurtailed: only unwinds if an error/termination occured, so that would mean not signalling the semaphore when everything goes as planned, and we leave the critical section...
I not suppose to replace #ensure: with #ifCurtailed:. I think about:signalRequired := false.
[
[signalRequired := true.
self wait] ifCurtailed: [signalRequired := false].blockValue := mutuallyExcludedBlock value
] ensure: [signalRequired ifTrue: [self signal]].
^blockValue