Skip to content

Instantly share code, notes, and snippets.

@Baha
Created January 11, 2016 14:04
Show Gist options
  • Save Baha/1468cc96438db71db0f2 to your computer and use it in GitHub Desktop.
Save Baha/1468cc96438db71db0f2 to your computer and use it in GitHub Desktop.
-module(receiver).
-export([main/0]).
main() -> receive
terminate -> io:fwrite("Receiver process finished\n")
end.
-module(sender).
-export([main/0]).
main() -> Pid = spawn(receiver,main,[]),
Fun = fun(Msg) -> Pid ! Msg end,
Fun(terminate),
io:fwrite("Sender process finished\n").
@Baha
Copy link
Author

Baha commented Jan 11, 2016

Output:

9> sender:main().
Sender process finished
Receiver process finished
ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment