blob: 793c27cadf9656d776f8d290d386ad3d69d32250 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-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}).
|