From a1c8bb40bde4090713225879aa1de025bb011f51 Mon Sep 17 00:00:00 2001 From: Kresten Krab Thorup Date: Mon, 23 Apr 2012 04:55:10 +0200 Subject: [PATCH] Send step_done when merge ends also MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … just to be nice, we'd get the {'DOWN', ...} anyway --- src/hanoi_merger.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hanoi_merger.erl b/src/hanoi_merger.erl index f1cfd02..93a5191 100644 --- a/src/hanoi_merger.erl +++ b/src/hanoi_merger.erl @@ -133,11 +133,17 @@ scan(BT1, BT2, Out, IsLastLevel, [{Key1,Value1}|AT]=AKVs, [{Key2,Value2}|BT]=BKV scan(BT1, BT2, Out2, IsLastLevel, AT, BT, Count+1, step(Step)) end. -scan_only(BT, Out, IsLastLevel, [], Count, Step) -> +scan_only(BT, Out, IsLastLevel, [], Count, {_, FromPID}=Step) -> case hanoi_reader:next_node(BT) of {node, KVs} -> scan_only(BT, Out, IsLastLevel, KVs, Count, step(Step)); end_of_data -> + case FromPID of + none -> + ok; + {PID, Ref} -> + PID ! {Ref, step_done} + end, {ok, Count, Out} end;