[erlang-patches] Add supervisor:start_child/3 to limit the number of children

Fredrik <>
Wed Apr 3 14:24:57 CEST 2013


On 04/03/2013 02:16 PM, Vance Shipley wrote:
> git fetch git://github.com/vances/otp.git supervisor_child_limit
>
> https://github.com/vances/otp/commit/04f94f86e5495f29b61654d7f744ae3eeaca9297
>
> With the addition of a Limit argument in start_child/3 the supervisor
> will either start a child or return {error,child_limit}.
>
> A supervisor behaviour process may have dynamically added children
> started by other processes.  The count of the number of children
> could be retrieved from the process with count_children/1 before
> starting another with start_child/2 if a maximum number of children
> is to be maintained.  This introduces an overhead of a round trip
> message and the possibility of a race condition.
>
> This is quite useful where a fixed size pool of processes might
> otherwise be used and is suitable for cases where child workers are
> started with high frequency.
>
Hello,
I have fetched your patch and as this introduces a new feature I have 
assigned it to responsible team to decide if this a desired behaviour.
Thanks for your contribution,

-- 

BR Fredrik Gustafsson
Erlang OTP Team



More information about the erlang-patches mailing list