Guest User

Untitled

a guest
Jul 6th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.37 KB | None | 0 0
  1. ping(Pong_PID) ->
  2.     Pong_PID ! {ping, self()},
  3.     receive
  4.         pong ->
  5.        io:format("Ping received pong~n", [])
  6.     end.
  7.  
  8. pong() ->
  9.     receive
  10.         {ping, Ping_PID} ->
  11.             io:format("Pong received ping~n", []),
  12.             Ping_PID ! pong
  13.     end.
  14.  
  15. start() ->
  16.     Pong_PID = spawn(ping_pong, pong, []),
  17.     spawn(ping_pong, ping, [Pong_PID]).
Add Comment
Please, Sign In to add comment