[squeak-dev] Abandoning in debugger and ensure: blocks
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Jun 21 09:32:57 UTC 2022
Hi Tony,
no, the semantics of Debugger's Abandon do not have changed: When you press Abandon, all ensure: contexts will be run that are not yet active.
Example 1:
[x := 1.
self halt]
ensure:
[x := 2].
If you abandon the debugger, x will be set to 2.
Example 2:
[x := 1.
^1]
ensure:
[x := 2.
self halt.
x := 3].
If you abandon the debugger, x will be set to 2 (but not to 3 - so the active ensure: context will *not* be continued).
The only thing that has changed is the semantics of Process >> #terminate:
Example 3:
[[x := 1.
Processor terminateActive]
ensure:
[x := 2]] fork.
x will be set to 2.
Example 4:
[[:exit | [x := 1.
exit value]
ensure:
[x := 2.
Processor terminateActive.
x := 3]] valueWithExit] fork.
In Squeak 5.3 and earlier, x will be set to 2 only.
In Squeak 6.0 and newer, x will be set to 3, so the active ensure context will indeed be completed during termination.
To restore the old termination semantics in Squeak 6.0, you can send #terminateAggressively instead of #terminate. This is what Debugger's Abandon uses under the hood.
You can find more examples in DebuggerTests no. 19 - 24. For the termination semantics, see also the tests in the AbstractProcessTest hierarchy.
HTH,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Tony Garnock-Jones <tonyg at leastfixedpoint.com>
Gesendet: Dienstag, 21. Juni 2022 10:50 Uhr
An: The general-purpose Squeak developers list
Betreff: [squeak-dev] Abandoning in debugger and ensure: blocks
Hi all,
Is it true that with recent changes to termination, if I "Abandon" a
process in the debugger, that process's `ensure:` blocks will NOT run?
That's a change from before, right?
Or am I mistaken?
If that's genuinely the case, is there some mechanism I should be using
to `reallyEnsure:` that something happens as part of process termination?
Thanks!
Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220621/651891dc/attachment.html>
More information about the Squeak-dev
mailing list
|