Product Site

5.1.2.16. start

Sends the message to start processing, while the sender also continues processing.

If target is specified, the message is sent to target and the receiving message object is changed to use the new target. Otherwise the message is sent to the target the message object provides.

If any arguments are specified, the message is sent with these arguments and the receiving message object is changed to use the new arguments. Otherwise the message is sent with any arguments the message object provides.

This method returns as soon as possible and does not wait until message processing is complete.

Note that once a message object has been started with either the start or the startWith method, it can not be run with any of the send/sendWith, start/startWith, reply/replyWith methods again. A message object can be run multiple times with methods send/sendWith and reply/replyWith.

The notify method can be used to request notification that message processing is complete. When message processing is complete, the message object retains any result and holds it until requested via the result method.

See also
Example 5.23. Message class - start method
ez=.testclass~new                  /* Creates a new instance of Testclass     */

/* Creates and starts message mymsg to send SHOWMSG to ez                     */
mymsg=ez~start("SHOWMSG","Hello, Ollie!",5)

/* Continue with main processing while SHOWMSG runs concurrently              */
do 5
  say "Hello, Stan!"
end

/* Get final result of the SHOWMSG method from the mymsg message object       */
say mymsg~result
say "Goodbye, Stan..."
exit

::class testclass public             /* Directive defines Testclass           */

::method showmsg                     /* Directive creates new method SHOWMSG  */
use arg text,reps                    /* class Testclass                       */
do reps
  say text
end
reply "Bye Bye, Ollie..."
return

The following output is possible:
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Bye Bye, Ollie...
Goodbye, Stan...