diff options
author | Damien F. Katz <damien@apache.org> | 2010-04-02 20:01:11 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2010-04-02 20:01:11 +0000 |
commit | c1ba70c38adef885ee50687210732c3999951a08 (patch) | |
tree | c96c961c0f08cde85d990151937a6aa58b43e294 /src/couchdb/couch_ref_counter.erl | |
parent | 3a30ebac70a7baef18719357c8b7ff00edbbfa83 (diff) |
Deterministic/synchronous shutdown code.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@930363 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_ref_counter.erl')
-rw-r--r-- | src/couchdb/couch_ref_counter.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/couchdb/couch_ref_counter.erl b/src/couchdb/couch_ref_counter.erl index 5c8e7437..96d92333 100644 --- a/src/couchdb/couch_ref_counter.erl +++ b/src/couchdb/couch_ref_counter.erl @@ -40,17 +40,18 @@ count(RefCounterPid) -> -record(srv, { - referrers=dict:new() % a dict of each ref counting proc. + referrers=dict:new(), % a dict of each ref counting proc. + child_procs=[] }). init({Pid, ChildProcs}) -> [link(ChildProc) || ChildProc <- ChildProcs], Referrers = dict:from_list([{Pid, {erlang:monitor(process, Pid), 1}}]), - {ok, #srv{referrers=Referrers}}. + {ok, #srv{referrers=Referrers, child_procs=ChildProcs}}. -terminate(Reason, _Srv) -> - couch_util:terminate_linked(Reason), +terminate(_Reason, #srv{child_procs=ChildProcs}) -> + [couch_util:shutdown_sync(Pid) || Pid <- ChildProcs], ok. |