Skip to content

Commit 5532e12

Browse files
axelsonjosevalim
authored andcommitted
Add a section to the docs about implementing a Module-based supervisor (#230)
1 parent f770cc5 commit 5532e12

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/consumer_supervisor.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ defmodule ConsumerSupervisor do
4444
4545
defmodule Printer do
4646
def start_link(event) do
47+
# Note: this function must return the format of `{:ok, pid}` and like
48+
# all children started by a Supervisor, the process must be linked
49+
# back to the supervisor (if you use `Task.start_link/1` then both
50+
# these requirements are met automatically)
4751
Task.start_link(fn ->
4852
IO.inspect({self(), event})
4953
end)

0 commit comments

Comments
 (0)