REPLY sends an early
reply from a method to its caller. The method issuing REPLY returns control,
and possibly a result, to its caller to the point from which the message was
sent; meanwhile, the method issuing REPLY continues running on a newly created thread.
If you specify expression,
it is evaluated and the object resulting from the evaluation is passed back.
If you omit expression, no object
is passed back.
Unlike RETURN or EXIT, the method issuing REPLY continues to run after
the REPLY until it issues an EXIT or RETURN instruction. The EXIT or RETURN
must not specify a result expression.
Example 2.33. Instructions — REPLY
reply42/* Returns control and a result */calltidyup/* Can run in parallel with sender */return
Notes:
You can use REPLY only in a method.
A method can execute only one REPLY instruction.
When the method issuing the REPLY instruction is the only
active method on the
current thread with exclusive access to the object's variable pool,
the method retains exclusive access on the new thread. When other methods
on the thread also have access, the method issuing the REPLY releases its access
and reacquires the access on the new thread. This might force the method
to wait until the original activity has released its access.