rec
).
Remote Execution Contexts (rec
).
'Remote Execution Context' is basically a
fancy way of saying 'workaround for rpc
'.
Some operations, such as file:open/2
, return an
object which is owned by the process that created it. When the
parent process dies, that object is expunged.
rpc:call/4
is not useful for such an operation,
because it executes the given function with a short-lived process.
A viable workaround is to instead use ce_rec:start/1
to create a long-lived process ('execution context') on a remote node,
ce_rec:rpc/2
to execute such an operation in that context,
and finally ce_rec:stop/1
when the objects owned by the
remote execution context are no longer needed.
rpc/2 | Equivalent to rpc(Pid, Fun, 10000). |
rpc/3 | Executes a fun/0 in a given remote execution context. |
start/1 | Starts an execution context on the given node. |
stop/1 | Shuts down the given execution context. |
rpc(Pid::pid(), Fun::'fun'()) -> term()
Equivalent to rpc(Pid, Fun, 10000).
rpc(Pid::pid(), Fun::'fun'(), Timeout::integer()) -> term()
Executes a fun/0
in a given remote execution context.
Returns the result of the fun. May exit with timeout
if
the call lasts more than Timeout
milliseconds.
Starts an execution context on the given node.
stop(Pid::rec()) -> ok | {error, Reason}
Shuts down the given execution context.
Generated by EDoc, Feb 18 2008, 06:48:02.