Module sscheduler

This modules provides utility functions for basic load balancing based on the scheduler id of the calling process.

Description

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.

It is not possible to locally look up the pid of a process with name {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.

Function Index

send/2Send a message to one element, selected based on the scheduler id, in a tuple of process names.
whereis_name/1Lookup the pid or process name of one element, selected based on the scheduler id, in a tuple of process names.

Function Details

send/2

send(Processes, Msg) -> ok

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.

whereis_name/1

whereis_name(Processes) -> Process | undefined

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.


Generated by EDoc, Sep 29 2016, 17:17:28.