Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Concurrent-computing/Erlang/concurrent-computing-1.erl
Normal file
19
Task/Concurrent-computing/Erlang/concurrent-computing-1.erl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-module(hw).
|
||||
-export([start/0]).
|
||||
|
||||
start() ->
|
||||
[ spawn(fun() -> say(self(), X) end) || X <- ['Enjoy', 'Rosetta', 'Code'] ],
|
||||
wait(2),
|
||||
ok.
|
||||
|
||||
say(Pid,Str) ->
|
||||
io:fwrite("~s~n",[Str]),
|
||||
Pid ! done.
|
||||
|
||||
wait(N) ->
|
||||
receive
|
||||
done -> case N of
|
||||
0 -> 0;
|
||||
_N -> wait(N-1)
|
||||
end
|
||||
end.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
|erlc hw.erl
|
||||
|erl -run hw start -run init stop -noshell
|
||||
Loading…
Add table
Add a link
Reference in a new issue