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})
end,
if (State#state.merge_pid == undefined)
orelse (WorkToDoHere =< 0) ->
MergeRef = undefined;
true ->
if WorkToDoHere > 0 ->
MergePID = State#state.merge_pid,
MergeRef = monitor(process, MergePID),
MergePID ! {step, {self(), MergeRef}, WorkToDoHere}
MergePID ! {step, {self(), MergeRef}, WorkToDoHere};
true ->
MergeRef = undefined
end,
if (Next =:= undefined) andalso (MergeRef =:= undefined) ->
if (DelegateRef =:= undefined) andalso (MergeRef =:= undefined) ->
%% 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 }),
main_loop(State2);
true ->