Make step code more explicit

This change has no semantic effect, only
makes the code easier to read
This commit is contained in:
Kresten Krab Thorup 2012-04-30 19:27:13 +02:00
parent 18c197d959
commit d6b8491a3d

View file

@ -577,18 +577,23 @@ do_step(StepFrom, HowMuch, State) ->
DelegateRef = plain_rpc:send_call(Next, {step, DelegateWork}) DelegateRef = plain_rpc:send_call(Next, {step, DelegateWork})
end, end,
if (State#state.merge_pid == undefined) if WorkToDoHere > 0 ->
orelse (WorkToDoHere =< 0) ->
MergeRef = undefined;
true ->
MergePID = State#state.merge_pid, MergePID = State#state.merge_pid,
MergeRef = monitor(process, MergePID), MergeRef = monitor(process, MergePID),
MergePID ! {step, {self(), MergeRef}, WorkToDoHere} MergePID ! {step, {self(), MergeRef}, WorkToDoHere};
true ->
MergeRef = undefined
end, end,
if (Next =:= undefined) andalso (MergeRef =:= undefined) -> if (DelegateRef =:= undefined) andalso (MergeRef =:= undefined) ->
%% nothing to do ... just return OK %% nothing to do ... just return OK
if (DelegateWork > 0) ->
?log("undone work: ~p", [DelegateWork]);
true ->
ok
end,
State2 = reply_step_ok(State#state { step_caller = StepFrom }), State2 = reply_step_ok(State#state { step_caller = StepFrom }),
main_loop(State2); main_loop(State2);
true -> true ->