diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-07-14 16:07:01 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-07-14 16:07:37 +0200 |
commit | 3e042cef5b85a60052b0a9bd1fc937079be95a0f (patch) | |
tree | c2f67e57c1df592c83fad56e061e54142404e22e /lib/tools | |
parent | 7a644113c11fec383365fe7a37a8a2d633afb386 (diff) | |
download | otp-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')
-rw-r--r-- | lib/tools/src/lcnt.erl | 6 |
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}. |