Permalink
Browse files

Remove exclusivity from safe_loop (only fix from combined_version)

  • Loading branch information...
1 parent 3e3aaa0 commit 64903e4d4a765ce8e9ca765f0a1a8ce59f833627 @Vagabond Vagabond committed Jul 24, 2010
Showing with 16 additions and 19 deletions.
  1. +16 −19 src/gen_leader.erl
View
@@ -460,24 +460,22 @@ safe_loop(#server{mod = Mod, state = State} = Server, Role,
#election{name = Name} = E, _PrevMsg) ->
%% Event for QuickCheck
%% ?EVENT({Role,E}),
- receive
- Msg ->
- case Msg of
- {system, From, Req} ->
- #server{parent = Parent, debug = Debug} = Server,
- sys:handle_system_msg(Req, From, Parent, ?MODULE, Debug,
- [safe, Server, Role, E]);
- {'EXIT', _, Reason} = Msg ->
- terminate(Reason, Msg, Server, Role, E);
- {halt,T,From} = Msg ->
- NewE = halting(E,T,From,Server),
- From ! {ackLeader,T,self()},
- safe_loop(Server,Role,NewE,Msg);
- {hasLeader,Ldr,T,_} = Msg ->
- NewE1 = mon_node(E,Ldr,Server),
- case ( (E#election.status == elec2) and (E#election.acks /= []) ) of
- true ->
- lists:foreach(
+ receive
+ {system, From, Req} ->
+ #server{parent = Parent, debug = Debug} = Server,
+ sys:handle_system_msg(Req, From, Parent, ?MODULE, Debug,
+ [safe, Server, Role, E]);
+ {'EXIT', _, Reason} = Msg ->
+ terminate(Reason, Msg, Server, Role, E);
+ {halt,T,From} = Msg ->
+ NewE = halting(E,T,From,Server),
+ From ! {ackLeader,T,self()},
+ safe_loop(Server,Role,NewE,Msg);
+ {hasLeader,Ldr,T,_} = Msg ->
+ NewE1 = mon_node(E,Ldr,Server),
+ case ( (E#election.status == elec2) and (E#election.acks /= []) ) of
+ true ->
+ lists:foreach(
fun(Node) ->
{Name,Node} ! {hasLeader,Ldr,T,self()}
end,E#election.acks);
@@ -665,7 +663,6 @@ safe_loop(#server{mod = Mod, state = State} = Server, Role,
end
end,
hasBecomeLeader(NewE,Server,Msg)
- end
end.

0 comments on commit 64903e4

Please sign in to comment.