diff options
author | Hans Bolinder <[email protected]> | 2017-12-01 11:40:18 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-12-20 13:55:08 +0100 |
commit | f842cf786897a48451c5b9d684c5ab0a30a18b16 (patch) | |
tree | ffdd7aa2f23901883f7381b22f9f1c0ac3f87893 /lib | |
parent | b8f16f0ab8099733a9fb1651c74af9cd1f8837ff (diff) | |
download | otp-f842cf786897a48451c5b9d684c5ab0a30a18b16.tar.gz otp-f842cf786897a48451c5b9d684c5ab0a30a18b16.tar.bz2 otp-f842cf786897a48451c5b9d684c5ab0a30a18b16.zip |
stdlib: Optimize gen a little
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/src/gen.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/stdlib/src/gen.erl b/lib/stdlib/src/gen.erl index 4b1d448487..0e6f49d99f 100644 --- a/lib/stdlib/src/gen.erl +++ b/lib/stdlib/src/gen.erl @@ -148,6 +148,10 @@ init_it2(GenMod, Starter, Parent, Name, Mod, Args, Options) -> call(Process, Label, Request) -> call(Process, Label, Request, ?default_timeout). +%% Optimize a common case. +call(Process, Label, Request, Timeout) when is_pid(Process), + Timeout =:= infinity orelse is_integer(Timeout) andalso Timeout >= 0 -> + do_call(Process, Label, Request, Timeout); call(Process, Label, Request, Timeout) when Timeout =:= infinity; is_integer(Timeout), Timeout >= 0 -> Fun = fun(Pid) -> do_call(Pid, Label, Request, Timeout) end, |