Skip to content

Instantly share code, notes, and snippets.

@cybergrind
Created January 10, 2013 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybergrind/4502413 to your computer and use it in GitHub Desktop.
Save cybergrind/4502413 to your computer and use it in GitHub Desktop.
-module(tr).
-compile([export_all]).
proc1() ->
timer:sleep(1000),
receive
{high, M} ->
io:format("~p~n", [M])
after
0 ->
receive
{med, M} ->
io:format("~p~n", [M])
after
0 ->
receive
{low, M} ->
io:format("~p~n", [M])
end
end
end,
proc1().
proc2() ->
Pid = spawn(tr, proc1, []),
Pid ! {low, low},
Pid ! {med, med},
Pid ! {high, high}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment