CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue