Download:
child 19:22714b5dcb49
parent 17:f187ebbdcfb3
18:9f635022d12d
Anton Shestakov <engored@ya.ru>, Sat, 01 Mar 2014 15:35:23 +0900
spawn_link everything.

1 файлов изменено, 5 вставок(+), 5 удалений(-) [+]
rps.erl file | annotate | diff | comparison | revisions
--- a/rps.erl Sat Mar 01 15:32:16 2014 +0900
+++ b/rps.erl Sat Mar 01 15:35:23 2014 +0900
@@ -30,16 +30,16 @@
end.
go() ->
- register(lobby, spawn(?MODULE, lobby, [])),
- register(counter, spawn(?MODULE, counter, [])),
- register(printer, spawn(?MODULE, printer, [])),
- [spawn(?MODULE, Bot, []) || Bot <- ?BOTS].
+ register(lobby, spawn_link(?MODULE, lobby, [])),
+ register(counter, spawn_link(?MODULE, counter, [])),
+ register(printer, spawn_link(?MODULE, printer, [])),
+ [spawn_link(?MODULE, Bot, []) || Bot <- ?BOTS].
lobby() ->
lobby([]).
lobby(Players) when length(Players) =:= length(?BOTS) ->
- Room = spawn(?MODULE, room, [Players]),
+ Room = spawn_link(?MODULE, room, [Players]),
lists:foreach(fun(Player) -> Player ! {room, Room} end, Players),
lobby([]);