start_link(Module, Args) -> Result
start_link(SupBridgeName, Module, Args) -> Result
Types
SupBridgeName =
{local, Name} | {global, GlobalName} | {via, Module, ViaName}Name = atom()GlobalName = ViaName = term()Module = module()Args = term()Result = {ok, Pid} | ignore | {error, Error}Error = {already_started, Pid} | term()Pid = pid()Creates a supervisor bridge process, linked to the calling process, which calls Module:init/1 to start the subsystem. To ensure a synchronized startup procedure, this function does not return until Module:init/1 has returned.
-
If
SupBridgeName={local,Name}, the supervisor bridge is registered locally asNameusingregister/2. -
If
SupBridgeName={global,GlobalName}, the supervisor bridge is registered globally asGlobalNameusingglobal:register_name/2. -
If
SupBridgeName={via,Module,ViaName}, the supervisor bridge is registered asViaNameusing a registry represented by Module. TheModulecallback is to export functionsregister_name/2,unregister_name/1, andsend/2, which are to behave like the corresponding functions inglobal. Thus,{via,global,GlobalName}is a valid reference.
If no name is provided, the supervisor bridge is not registered.
Module is the name of the callback module.
Args is an arbitrary term that is passed as the argument to Module:init/1.
-
If the supervisor bridge and the subsystem are successfully started, the function returns
{ok,Pid}, wherePidis is the pid of the supervisor bridge. -
If there already exists a process with the specified
SupBridgeName, the function returns{error,{already_started,Pid}}, wherePidis the pid of that process. -
If
Module:init/1returnsignore, this function returnsignoreas well and the supervisor bridge terminates with reasonnormal. -
If
Module:init/1fails or returns an error tuple or an incorrect value, this function returns{error,Error}, whereErroris a term with information about the error, and the supervisor bridge terminates with reasonError.