diff options
author | Sverker Eriksson <[email protected]> | 2018-03-05 15:47:59 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-03-05 15:47:59 +0100 |
commit | 5a1b9a836675b025eb1611f23ee9e2f5e4efa156 (patch) | |
tree | cca511d278923fe7e742bcaba057c1a957328a88 /lib/stdlib/src | |
parent | b0860754c392a591389f5f35ee5458758f6db10f (diff) | |
download | otp-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.
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/gen.erl | 9 |
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} -> |