blob: 793c27cadf9656d776f8d290d386ad3d69d32250 (
plain) (
tree)
|
|
-module(remote).
-export([start/0, calculate/1]).
rpc(C) ->
rechner ! {self(), C},
receive
{rechner, Reply} ->
Reply
end.
loop() ->
receive
{From, {calculate, String}} ->
From ! {rechner, calc:eval(String)},
loop()
end.
start() ->
register(rechner, spawn(fun() -> loop() end)).
calculate(String) ->
rpc({calculate, String}).
|