Created
October 6, 2011 21:55
-
-
Save kristjan/1268795 to your computer and use it in GitHub Desktop.
An example of loading code over the network. See https://github.com/kristjan/erlang_playground for the full code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{echo, Server} ! {netload, fun run_faster/0, self()}. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(echo). | |
-export([start/0, run/0]). | |
start() -> | |
register(echo, spawn(echo, run, [])). | |
run() -> | |
receive | |
% ...snip... | |
{netload, Fn, Sender} -> | |
io:format("Received new code ~p~n", [Fn]), | |
Sender ! {reply, "Your wish is my command."}, | |
Fn() | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment