sscheduler (sbroker v1.1.2)
This modules provides utility functions for basic load balancing based on the scheduler id of the calling process. It is designed for use with OTP behaviour messaging using via names, e.g. {via, sscheduler, {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 based on the scheduler id, 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.
Summary
Functions
Send a message to one element, selected based on the scheduler id, 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.Lookup the pid or process name of one element, selected based on the scheduler id, in a tuple of process names. If no process is associated with the name returns
undefined.Functions
Link to this function
send(Processes, Msg)
-spec send(Processes, Msg) -> ok when Processes :: tuple(), Msg :: any().
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.
Link to this function
whereis_name(Processes)
-spec whereis_name(Processes) -> Process | undefined when Processes :: tuple(), Process :: pid().
undefined.