Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added explanatory note to Horde.DynamicSupervisor #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/horde/dynamic_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ defmodule Horde.DynamicSupervisor do
```

Then you can use `MySupervisor.child_spec/1` and `MySupervisor.start_link/1` in the same way as you'd use `Horde.DynamicSupervisor.child_spec/1` and `Horde.DynamicSupervisor.start_link/1`.

## Warning: Names and pids are not interchangeable

In general, the API for Horde.DynamicSupervisor works the same way as the stdlib DynamicSupervisor.

Howerver, one major difference is that the pid returned by the `start_link` function is not interchangeable with the name of the supervisor.

This is because a Horde DynamicSupervisor is actually composed of a set of processes that perform necessary functionality, whereas a standard DynamicSupervisor is only one process.

So, always use the name of the Horde.DynamicSupervisor as the input to functions in this module, and not the pid.

Using the pid directly will cause undefined behaviour.

See here for more info: https://github.com/derekkraan/horde/issues/269
"""
use Supervisor

Expand Down