From d318717866ffa267781ab482e99a05415e2ac0e4 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Thu, 4 Mar 2010 03:10:19 +0000 Subject: reverting damien's latest commit until we can figure out why it's causing failures git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@918834 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_file.erl | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/couchdb/couch_file.erl') diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index 4c6928a7..5904260c 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -176,21 +176,13 @@ sync(Fd) -> gen_server:call(Fd, sync, infinity). %%---------------------------------------------------------------------- -%% Purpose: Close the file. +%% Purpose: Close the file. Is performed asynchronously. %% Returns: ok %%---------------------------------------------------------------------- close(Fd) -> - MRef = erlang:monitor(process, Fd), - try - catch unlink(Fd), - catch exit(Fd, shutdown), - receive - {'DOWN', MRef, _, _, _} -> - ok - end - after - erlang:demonitor(MRef, [flush]) - end. + Result = gen_server:cast(Fd, close), + catch unlink(Fd), + Result. % 09 UPGRADE CODE old_pread(Fd, Pos, Len) -> @@ -227,7 +219,6 @@ init_status_error(ReturnPid, Ref, Error) -> % server functions init({Filepath, Options, ReturnPid, Ref}) -> - process_flag(trap_exit, true), case lists:member(create, Options) of true -> filelib:ensure_dir(Filepath), @@ -441,8 +432,6 @@ handle_cast(close, Fd) -> code_change(_OldVsn, State, _Extra) -> {ok, State}. -handle_info({'EXIT', _, normal}, Fd) -> - {noreply, Fd}; handle_info({'EXIT', _, Reason}, Fd) -> {stop, Reason, Fd}. -- cgit v1.2.3