--- a/rps.erl Sat Mar 01 15:32:16 2014 +0900
+++ b/rps.erl Sat Mar 01 15:35:23 2014 +0900
- 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(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),