Make step code more explicit
This change has no semantic effect, only makes the code easier to read
This commit is contained in:
parent
18c197d959
commit
d6b8491a3d
1 changed files with 11 additions and 6 deletions
|
@ -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 ->
|
||||||
|
|
Loading…
Reference in a new issue