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.
| Exported Functions | |
|---|---|
| rpc/2 | See rpc/3. |
| 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. |
| Internal Documented Functions | |
| execution_context/0 | Driver loop for each remote execution context. |
rpc(pid(), fun()) -> term()
Equivalent to rpc(Pid, Fun, 10000).
rpc(pid(), 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.
start(node()) -> rec()
Starts an execution context on the given node.
stop(rec()) -> ok | {error, Reason}
Shuts down the given execution context.
execution_context() -> never_returns()
Driver loop for each remote execution context.