This modules provides utility functions for basic load balancing based
on choosing a random process. It is designed for use with OTP behaviour
messaging using via names, e.g. {via, srand, {Process,...}}. The third
element, {Process,...}, is a tuple containing pids (pid()) and/or
process names (atom(), {global, any()}, {via, module(), any()} or
{atom(), node()}). An element is chosen randomly, if the element is a
pid() it is returned, otherwise the pid() of the process name is looked
up.
{atom(), node()} if the node is not the local node. Therefore a registered
name on another node is not supported for use with this module.
| send/2 | Send a message to one element, selected randomly, in a tuple of process names. |
| whereis_name/1 | Lookup the pid or process name of one element, selected randomly, in a tuple of process names. |
send(Processes, Msg) -> ok
Send a message to one element, selected randomly, in a tuple of process
names. Returns ok if the element chosen is a pid(). a locally registered
name on another node, or a process is associated with the name. Otherwise
exits.
whereis_name(Processes) -> Process | undefined
Lookup the pid or process name of one element, selected randomly, in a
tuple of process names. If no process is associated with the name returns
undefined.
Generated by EDoc