diff options
Diffstat (limited to 'src/couchdb/couch_util.erl')
-rw-r--r-- | src/couchdb/couch_util.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/couchdb/couch_util.erl b/src/couchdb/couch_util.erl index bd377d80..a119cf1c 100644 --- a/src/couchdb/couch_util.erl +++ b/src/couchdb/couch_util.erl @@ -12,7 +12,7 @@ -module(couch_util). --export([start_driver/1]). +-export([start_driver/1,terminate_linked/1]). -export([should_flush/0, should_flush/1, to_existing_atom/1, to_binary/1]). -export([new_uuid/0, rand32/0, implode/2, collate/2, collate/3]). -export([abs_pathname/1,abs_pathname/2, trim/1, ascii_lower/1]). @@ -43,6 +43,14 @@ to_existing_atom(V) when is_atom(V)-> V. +terminate_linked(normal) -> + terminate_linked(shutdown); +terminate_linked(Reason) -> + {links, Links} = process_info(self(), links), + [catch exit(Pid, Reason) || Pid <- Links], + ok. + + new_uuid() -> list_to_binary(to_hex(crypto:rand_bytes(16))). |