@@ -215,10 +215,7 @@ defmodule DynamicSupervisor do
215
215
extra_arguments: [ term ( ) ]
216
216
}
217
217
218
- @ typedoc "Options given to `start_link` functions"
219
- @ type option :: GenServer . option ( )
220
-
221
- @ typedoc "Options given to `start_link` and `init/1` functions"
218
+ @ typedoc "Options given to `start_link/1` and `init/1` functions"
222
219
@ type init_option ::
223
220
{ :strategy , strategy ( ) }
224
221
| { :max_restarts , non_neg_integer ( ) }
@@ -345,9 +342,11 @@ defmodule DynamicSupervisor do
345
342
specified in the child spec given to `start_child/2`. Defaults to
346
343
an empty list.
347
344
345
+ * Any of the standard [GenServer options](`t:GenServer.option/0`)
346
+
348
347
"""
349
348
@ doc since: "1.6.0"
350
- @ spec start_link ( [ option | init_option ] ) :: Supervisor . on_start ( )
349
+ @ spec start_link ( [ init_option | GenServer . option ( ) ] ) :: Supervisor . on_start ( )
351
350
def start_link ( options ) when is_list ( options ) do
352
351
keys = [ :extra_arguments , :max_children , :max_seconds , :max_restarts , :strategy ]
353
352
{ sup_opts , start_opts } = Keyword . split ( options , keys )
@@ -381,9 +380,15 @@ defmodule DynamicSupervisor do
381
380
Note that a supervisor started with this function is linked to the parent
382
381
process and exits not only on crashes but also if the parent process exits
383
382
with `:normal` reason.
383
+
384
+ ## Options
385
+
386
+ This function accepts any regular [`GenServer` options](`t:GenServer.option/0`).
387
+ Options specific to `DynamicSupervisor` must be returned from the `c:init/1`
388
+ callback.
384
389
"""
385
390
@ doc since: "1.6.0"
386
- @ spec start_link ( module , term , [ option ] ) :: Supervisor . on_start ( )
391
+ @ spec start_link ( module , term , [ GenServer . option ( ) ] ) :: Supervisor . on_start ( )
387
392
def start_link ( module , init_arg , opts \\ [ ] ) do
388
393
GenServer . start_link ( __MODULE__ , { module , init_arg , opts [ :name ] } , opts )
389
394
end
0 commit comments