[Vm-dev] Re: [Pharo-dev] Interrupting processes question. Can
method return be interrupted?
eliot.miranda at gmail.com
Thu Jan 7 16:44:33 UTC 2016
On Thu, Jan 7, 2016 at 7:54 AM, Denis Kudriashov <dionisiydk at gmail.com>
> Look at example:
> | result |
> result := false.
> [result := self methodB] ensure: [result ifTrue: [...]]
> result := 1 < 2.
> Imagine now that methodB starts execution in context of call inside
> Is it possible to terminate process at point of methodB return (^result)?
> In that case ensure block in methodA will perform wrong logic.
Returns are not suspension points, so no. In the Cog and Stack VMs the
only suspension points are backward jumps (at the end of while loops) and
method activations. Note that invocations of methods with primitives
(including quick methods, e.g. ^true or ^instVar) are not suspension
points, unless their primitives fail, or unless the primitives are suspend,
wait et al.
In the interpreter VM (incorrectly IMO) primitive invocation in the context
of a perform:, tryPrimitive:, executeMethod: primitive is also a suspension
point. i.e. /any/ primitive including a quick primitive invoked via
primitives 83, 84, 100, 188, 188 & 189, could potentially be a suspension
point, in which case the process would be suspended immediately following
the send that invoked the primitive.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev