Product SiteDocumentation Site

2.24. REPLY


>>-REPLY--+------------+--;------------------------------------><
          +-expression-+

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.39. Instructions - REPLY

reply 42           /* Returns control and a result    */
call tidyup        /* Can run in parallel with sender */
return

Notes:
  1. You can use REPLY only in a method.
  2. A method can execute only one REPLY instruction.
  3. 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.
See Chapter 12, Concurrency for a complete description of concurrency.