The most simple and probably the most common remote call variant is asynchronous remote call. It has best effort and one-way semantics: the call will be performed at most once and the callee does not inform the caller about the results of the call. As long as the callee object is reachable by the standard localization protocols, the call will be performed exactly once.
To initiate an asynchronous call to method FUNCNAME, call the async_FUNCNAME method of the stub object:
/* Call method bar of object foo, passing 1 as param. */ foo->async_bar( 1 ); /* Call method baz of object foo, passing 2 as param. */ foo->async_baz( 2 ); |
This call will create a RPC request, schedule its migration to the callee object, and return immediately. When the request is delivered to the callee node, the target method will be called. The result returned by the method and modifications of the out (or inout) arguments will be forgotten. There is no way to determine the status and the result of the call by the caller.
As you can see, async_ methods that perform the call don't have the same signature as the methods they call. The following differences apply:
The out arguments are not passed to the async_ methods.
The inout arguments are passed to the async_ methods, but they will not be modified.
The return type of the async_ methods is always Pointer< ResultObject >. You can safely ignore it, beacuse it will be always a null pointer, unless reply to the call is requested by the caller (see Section 8.5.4, “Getting Reply to Asynchronous RPC”.)
In the example in the previous section, the request was sent to the callee node as soon as possible. Execution of the call can be also scheduled to some specific simulation time using the param() method of the stub object:
/* Call method bar of object foo, passing 1 as param. The call will be performed when the global simulation time reaches 1000 seconds. */ foo->param( RPC_TIMED, STime( 1000.0 ) ).async_bar( 1 ); /* Call method baz of object foo, passing 2 as param. The call will be performed in 10 seconds. */ foo->param( RPC_DELAYED, STime( 10.0 ) ).async_baz( 2 ); |
The param() method is described in RPCStubs, examples of advanced use of this method can be seen in Section 8.5, “Advanced Techniques”.