aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-03-05 15:47:59 +0100
committerSverker Eriksson <[email protected]>2018-03-05 15:47:59 +0100
commit5a1b9a836675b025eb1611f23ee9e2f5e4efa156 (patch)
treecca511d278923fe7e742bcaba057c1a957328a88
parentb0860754c392a591389f5f35ee5458758f6db10f (diff)
downloadotp-5a1b9a836675b025eb1611f23ee9e2f5e4efa156.tar.gz
otp-5a1b9a836675b025eb1611f23ee9e2f5e4efa156.tar.bz2
otp-5a1b9a836675b025eb1611f23ee9e2f5e4efa156.zip
stdlib: Fix receive-ref optimization for gen_server:call
Optimization does not trigger for try-catch. But send cannot fail here anyway, as Process cannot be an atom.
-rw-r--r--lib/stdlib/src/gen.erl9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/stdlib/src/gen.erl b/lib/stdlib/src/gen.erl
index 293cb98ad2..2e6223d2bb 100644
--- a/lib/stdlib/src/gen.erl
+++ b/lib/stdlib/src/gen.erl
@@ -157,15 +157,14 @@ call(Process, Label, Request, Timeout)
Fun = fun(Pid) -> do_call(Pid, Label, Request, Timeout) end,
do_for_proc(Process, Fun).
-do_call(Process, Label, Request, Timeout) ->
+do_call(Process, Label, Request, Timeout) when is_atom(Process) =:= false ->
Mref = erlang:monitor(process, Process),
+
%% OTP-21:
%% Auto-connect is asynchronous. But we still use 'noconnect' to make sure
%% we send on the monitored connection, and not trigger a new auto-connect.
- try erlang:send(Process, {Label, {self(), Mref}, Request}, [noconnect])
- catch
- error:_ -> ok
- end,
+ %%
+ erlang:send(Process, {Label, {self(), Mref}, Request}, [noconnect]),
receive
{Mref, Reply} ->