Advertisement
Guest User

Untitled

a guest
Apr 15th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.57 KB | None | 0 0
  1.  Pid = spawn(Mod, Func, Args)       % uruchamia funkcje Func jako nowy proces
  2.  Pid = spawn(Node, Mod, Func, Args) % uruchamia funkcje Func na zdalnym węźle Node
  3.  
  4.  Pid ! a_message      % wysyła wiadomość do procesu (asynchronicznie)
  5.  
  6.  receive       % odbiera wiadomość wysłaną do tego procesu
  7.    a_message -> do_something;
  8.    {data, Data_content} -> do_something_else(); % To jest 2-ka składają się z atomu i pewnych danych
  9.    {hello, Text} -> io:format("Got hello message: ~s", [Text]);
  10.    {goodbye, Text} -> io:format("Got goodbye message: ~s", [Text])
  11.  end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement