z_proc (zotonic_core v1.0.0-rc.17)

Process registry interface for a site and proc_lib routines to spawn new processes whilst keeping the logger metadata.

Summary

Functions

Register a Pid under Name. Name can be any erlang term.

Spawn a new process using proc_lib and copy the logger metadata from the calling process to the new process.

Spawn a new process using proc_lib and copy the logger metadata from the calling process to the new process.

Spawn a new process using proc_lib and copy the logger metadata from the calling process to the new process. Pass options to proc_lib for spawning the process.

Unregister the current process.

Lookup the pid of the process.

Functions

register(Name, Pid, Site)

-spec register(Name, Pid, Site) -> ok | {error, duplicate}
                  when Name :: term(), Pid :: pid(), Site :: z:context() | atom().

Register a Pid under Name. Name can be any erlang term.

register_name(Name, Pid)

send(Name, Msg)

spawn_md(Fun)

-spec spawn_md(Fun) -> Pid when Fun :: function(), Pid :: pid().

Spawn a new process using proc_lib and copy the logger metadata from the calling process to the new process.

spawn_md_opt(Fun, SpawnOpts)

-spec spawn_md_opt(Fun, SpawnOpts) -> Pid | {Pid, Reference}
                      when
                          Fun :: function(),
                          SpawnOpts :: [proc_lib:spawn_option()],
                          Pid :: pid(),
                          Reference :: reference().

Spawn a new process using proc_lib and copy the logger metadata from the calling process to the new process. Pass options to proc_lib for spawning the process.

unregister(Name, Site)

-spec unregister(Name, Site) -> ok | {error, enoent} when Name :: term(), Site :: z:context() | atom().

Unregister the current process.

unregister_name(Name)

whereis(Name, Site)

-spec whereis(Name, Site) -> undefined | pid() when Name :: term(), Site :: z:context() | atom().

Lookup the pid of the process.

whereis_name(Name)