# Module sup

- Description
- Data Types
- Function Index
- Function Details

Supervisor helper functions for better control of startup phase.

Copyright © 2007-2015 Zuse Institute Berlin

Version: $Id$

Authors: Florian Schintke (`schintke@zib.de`).

## Description

Supervisor helper functions for better control of startup phase.

Start the supervisor separately and then add its childs one after the other.

## Data Types

### prefix()

    prefix() = nonempty_maybe_improper_list(string(), string())

### startlink_err()

    startlink_err() = {already_started, pid()} | shutdown | term()

### startlink_ret()

    startlink_ret() = {ok, pid()} | {error, startlink_err()}

### sup_name()

    sup_name() = {local, Name :: atom()} | {global, Name :: atom()}

### sup_ref()

    sup_ref() =
        (Name :: atom()) |
        {Name :: atom(), Node :: node()} |
        {global, Name :: atom()} |
        pid()

## Function Index

start_sup_as_child/3 |
sup_get_all_children/1 |
sup_start/3 |
sup_terminate/1 |
sup_terminate_childs/1 | Terminates all children of the given supervisor(s) gracefully, i.e.
supervisor_desc/3 | Creates a supervisor description for a supervisor.
supervisor_desc/4 | Creates a supervisor description for a supervisor.
worker_desc/3 | Creates a worker description for a supervisor.
worker_desc/4 | Creates a worker description for a supervisor.

## Function Details

### sup_start/3

    sup_start(Supervisor :: sup_name(),
              Module :: module(),
              Options :: term()) ->
                 startlink_ret()

### start_sup_as_child/3

    start_sup_as_child(Prefix :: prefix(),
                       AtSup :: sup_ref() | no_name,
                       SupAsChild :: supervisor:child_spec()) ->
                          supervisor:startchild_ret()

### worker_desc/3

    worker_desc(Name :: atom() | string() | {atom(), pos_integer()},
                Module :: module(),
                Function :: atom()) ->
                   {Name ::
                        atom() | string() | {atom(), pos_integer()},
                    {Module :: module(),
                     Function :: atom(),
                     Options :: []},
                    permanent,
                    brutal_kill,
                    worker,
                    []}

Creates a worker description for a supervisor.

### worker_desc/4

    worker_desc(Name :: atom() | string() | {atom(), pos_integer()},
                Module :: module(),
                Function :: atom(),
                Options :: list()) ->
                   {Name ::
                        atom() | string() | {atom(), pos_integer()},
                    {Module :: module(),
                     Function :: atom(),
                     Options :: list()},
                    permanent,
                    brutal_kill,
                    worker,
                    []}

Creates a worker description for a supervisor.

### supervisor_desc/3

    supervisor_desc(Name ::
                        atom() | string() | {atom(), pos_integer()},
                    Module :: module(),
                    Function :: atom()) ->
                       {Name ::
                            atom() |
                            string() |
                            {atom(), pos_integer()},
                        {Module :: module(),
                         Function :: atom(),
                         Options :: []},
                        permanent,
                        brutal_kill,
                        supervisor,
                        []}

Creates a supervisor description for a supervisor.

### supervisor_desc/4

    supervisor_desc(Name ::
                        atom() | string() | {atom(), pos_integer()},
                    Module :: module(),
                    Function :: atom(),
                    Options :: list()) ->
                       {Name ::
                            atom() |
                            string() |
                            {atom(), pos_integer()},
                        {Module :: module(),
                         Function :: atom(),
                         Options :: list()},
                        permanent,
                        brutal_kill,
                        supervisor,
                        []}

Creates a supervisor description for a supervisor.

### sup_terminate/1

    sup_terminate(Supervisor :: pid() | atom()) -> ok

### sup_terminate_childs/1

    sup_terminate_childs(Supervisor :: Proc | [Proc]) -> ok

-     Proc = pid() | atom()

Terminates all children of the given supervisor(s) gracefully, i.e. first stops all gen_component processes and then terminates all children recursively. Note: the children beneath the given supervisor pids MUST NOT overlap!

### sup_get_all_children/1

    sup_get_all_children(Supervisor :: pid() | atom()) -> [pid()]

Generated by EDoc, Feb 29 2016, 16:12:21.