Issue #94: simplified `RecursionLock >> #critical:`
Nore, that `#acquireWithTimeoutMs:` may never fail when
timeout is nil (meaning wait indefinitely).
--- a/RecursionLock.st Mon Oct 09 00:08:34 2017 +0100
+++ b/RecursionLock.st Sat Oct 28 21:47:57 2017 +0100
@@ -362,16 +362,12 @@
<exception: #unwind>
- | acquired retval |
+ | retval |
- acquired := self acquireWithTimeoutMs: nil.
- acquired == true ifTrue:[
- retval := aBlock value
- ].
+ self acquireWithTimeoutMs: nil.
+ retval := aBlock value.
thisContext unmarkForUnwind.
- acquired == true ifTrue:[
- self release.
- ].
+ self release.
^ retval
"Created: / 31-08-2017 / 10:12:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -381,13 +377,7 @@
unwindHandlerInContext:aContext
aContext selector == #critical: ifTrue:[
- | acquired |
- acquired := aContext varAt: 1.
- acquired == true ifTrue:[
- ^ [ aContext varAt: 1 put: nil. self release ]
- ] ifFalse:[
- ^ nil.
- ].
+ ^ [ self release ]
].
self shouldNeverBeReached.