Created
January 11, 2016 14:04
-
-
Save Baha/1468cc96438db71db0f2 to your computer and use it in GitHub Desktop.
This file contains 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(receiver). | |
-export([main/0]). | |
main() -> receive | |
terminate -> io:fwrite("Receiver process finished\n") | |
end. |
This file contains 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(sender). | |
-export([main/0]). | |
main() -> Pid = spawn(receiver,main,[]), | |
Fun = fun(Msg) -> Pid ! Msg end, | |
Fun(terminate), | |
io:fwrite("Sender process finished\n"). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output:
9> sender:main().
Sender process finished
Receiver process finished
ok