aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/src
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-07-14 16:07:01 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-07-14 16:07:37 +0200
commit3e042cef5b85a60052b0a9bd1fc937079be95a0f (patch)
treec2f67e57c1df592c83fad56e061e54142404e22e /lib/tools/src
parent7a644113c11fec383365fe7a37a8a2d633afb386 (diff)
downloadotp-3e042cef5b85a60052b0a9bd1fc937079be95a0f.tar.gz
otp-3e042cef5b85a60052b0a9bd1fc937079be95a0f.tar.bz2
otp-3e042cef5b85a60052b0a9bd1fc937079be95a0f.zip
tools: Use call instead of cast to stop lcnt server
Mitigate gen_server:cast/2 race conditions in testcases.
Diffstat (limited to 'lib/tools/src')
-rw-r--r--lib/tools/src/lcnt.erl6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/tools/src/lcnt.erl b/lib/tools/src/lcnt.erl
index f89b0ccf29..f1251fddab 100644
--- a/lib/tools/src/lcnt.erl
+++ b/lib/tools/src/lcnt.erl
@@ -131,7 +131,7 @@
%% -------------------------------------------------------------------- %%
start() -> gen_server:start({local, ?MODULE}, ?MODULE, [], []).
-stop() -> gen_server:cast(?MODULE, stop).
+stop() -> gen_server:call(?MODULE, stop, infinity).
init([]) -> {ok, #state{ locks = [], duration = 0 } }.
%% -------------------------------------------------------------------- %%
@@ -410,6 +410,8 @@ handle_call({save, Filename}, _From, State) ->
{reply, {error, Error}, State}
end;
+handle_call(stop, _From, State) ->
+ {stop, normal, ok, State};
handle_call(Command, _From, State) ->
{reply, {error, {undefined, Command}}, State}.
@@ -420,8 +422,6 @@ handle_call(Command, _From, State) ->
%%
%% -------------------------------------------------------------------- %%
-handle_cast(stop, State) ->
- {stop, normal, State};
handle_cast(_, State) ->
{noreply, State}.