equal
deleted
inserted
replaced
360 Returns the (return) value of `aBlock` |
360 Returns the (return) value of `aBlock` |
361 " |
361 " |
362 |
362 |
363 <exception: #unwind> |
363 <exception: #unwind> |
364 |
364 |
365 | acquired retval | |
365 | retval | |
366 |
366 |
367 acquired := self acquireWithTimeoutMs: nil. |
367 self acquireWithTimeoutMs: nil. |
368 acquired == true ifTrue:[ |
368 retval := aBlock value. |
369 retval := aBlock value |
|
370 ]. |
|
371 thisContext unmarkForUnwind. |
369 thisContext unmarkForUnwind. |
372 acquired == true ifTrue:[ |
370 self release. |
373 self release. |
|
374 ]. |
|
375 ^ retval |
371 ^ retval |
376 |
372 |
377 "Created: / 31-08-2017 / 10:12:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
373 "Created: / 31-08-2017 / 10:12:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
378 ! ! |
374 ! ! |
379 |
375 |
380 !RecursionLock methodsFor:'unwinding'! |
376 !RecursionLock methodsFor:'unwinding'! |
381 |
377 |
382 unwindHandlerInContext:aContext |
378 unwindHandlerInContext:aContext |
383 aContext selector == #critical: ifTrue:[ |
379 aContext selector == #critical: ifTrue:[ |
384 | acquired | |
380 ^ [ self release ] |
385 acquired := aContext varAt: 1. |
|
386 acquired == true ifTrue:[ |
|
387 ^ [ aContext varAt: 1 put: nil. self release ] |
|
388 ] ifFalse:[ |
|
389 ^ nil. |
|
390 ]. |
|
391 ]. |
381 ]. |
392 self shouldNeverBeReached. |
382 self shouldNeverBeReached. |
393 |
383 |
394 "Created: / 31-08-2017 / 10:11:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
384 "Created: / 31-08-2017 / 10:11:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
395 ! ! |
385 ! ! |