diff options
author | Anders Svensson <[email protected]> | 2017-06-12 21:54:50 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-06-13 15:30:24 +0200 |
commit | fd2850798f68c9a3c502ad9d66ef46561816ab6f (patch) | |
tree | c1f561e711cba38f62cad9ab547f695f0d6d7bdc /lib/diameter/src/base/diameter_config.erl | |
parent | 205521d3927ed6f53c9a6fa3095f8a879bdca929 (diff) | |
download | otp-fd2850798f68c9a3c502ad9d66ef46561816ab6f.tar.gz otp-fd2850798f68c9a3c502ad9d66ef46561816ab6f.tar.bz2 otp-fd2850798f68c9a3c502ad9d66ef46561816ab6f.zip |
Let spawn_opt config replace erlang:spawn_opt/2 for request processes
By accepting an MFA that is applied to the fun that is otherwise spawned
for each incoming request, to allow handler processes to be reused. This
is not yet documented and may change, but the motivation is to let spawn
be replaced by process pool, from which the MFA selects. A list-valued
spawn_opt is equivalent to {erlang, spawn_opt, [Opts]}.
Diffstat (limited to 'lib/diameter/src/base/diameter_config.erl')
-rw-r--r-- | lib/diameter/src/base/diameter_config.erl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/diameter/src/base/diameter_config.erl b/lib/diameter/src/base/diameter_config.erl index 1db9b52dfa..99d8c8c6ec 100644 --- a/lib/diameter/src/base/diameter_config.erl +++ b/lib/diameter/src/base/diameter_config.erl @@ -610,6 +610,9 @@ opt({watchdog_timer, Tmo}) -> opt({watchdog_config, L}) -> is_list(L) andalso lists:all(fun wdopt/1, L); +opt({spawn_opt, {M,F,A}}) + when is_atom(M), is_atom(F), is_list(A) -> + true; opt({spawn_opt = K, Opts}) -> if is_list(Opts) -> {value, {K, spawn_opts(Opts)}}; @@ -739,6 +742,10 @@ opt(incoming_maxlen, N) when 0 =< N, N < 1 bsl 24 -> N; +opt(spawn_opt, {M,F,A} = T) + when is_atom(M), is_atom(F), is_list(A) -> + T; + opt(spawn_opt, L) when is_list(L) -> spawn_opts(L); |