aboutsummaryrefslogblamecommitdiffstats
path: root/lib/stdlib/doc/src/pg.xml
blob: c56db8c6e61f23901cd62bdde8d9c1f2bb77f42c (plain) (tree)
1
2
3
4
5
6
7
8





                                        
                       











































                                                                        
                                     
                                                
            
                                                                                 


                   
                                     
                                                                
            
                                                                              

             
                                   
                                                        
            
                                                                     


                                                             
                                   
                                                                           
                                                                    

                                                                            


                                                               
                                    
                                                                                             
                                                                    
                                                                             
                        
                                                                            


                                                               
                                      
                                                                          






                                                             
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1996</year>
      <year>2011</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
  The contents of this file are subject to the Erlang Public License,
  Version 1.1, (the "License"); you may not use this file except in
  compliance with the License. You should have received a copy of the
  Erlang Public License along with this software. If not, it can be
  retrieved online at http://www.erlang.org/.

  Software distributed under the License is distributed on an "AS IS"
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  the License for the specific language governing rights and limitations
  under the License.

  The Initial Developer of the Original Code is Ericsson AB.
    </legalnotice>

    <title>pg</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
  </header>
  <module>pg</module>
  <modulesummary>Distributed, Named Process Groups</modulesummary>
  <description>
    <p>This (experimental) module implements process groups. A process
      group is a group of processes that can be accessed by a common
      name. For example, a group named <c>foobar</c> can include a set
      of processes as members of this group and they can be located on
      different nodes.</p>
    <p>When messages are sent to the named group, all members of
      the group receive the message. The messages are serialized. If
      the process <c>P1</c> sends the message <c>M1</c> to the group,
      and process <c>P2</c> simultaneously sends message <c>M2</c>, then
      all members of the group receive the two messages in the same
      order. If members of a group terminate, they are automatically 
      removed from the group.</p>
    <p>This module is not complete. The module is inspired by the ISIS
      system and the causal order protocol of the ISIS system should 
      also be implemented. At the moment, all messages are serialized
      by sending them through a group master process.</p>
  </description>
  <funcs>
    <func>
      <name name="create" arity="1"/>
      <fsummary>Create an empty group</fsummary>
      <desc>
        <p>Creates an empty group named <c><anno>PgName</anno></c> on the current
          node.</p>
      </desc>
    </func>
    <func>
      <name name="create" arity="2"/>
      <fsummary>Create an empty group on another node</fsummary>
      <desc>
        <p>Creates an empty group named <c><anno>PgName</anno></c> on the node
          <c><anno>Node</anno></c>.</p>
      </desc>
    </func>
    <func>
      <name name="join" arity="2"/>
      <fsummary>Join a pid to a process group</fsummary>
      <desc>
        <p>Joins the pid <c><anno>Pid</anno></c> to the process group
          <c><anno>PgName</anno></c>.
          Returns a list of all old members of the group.</p>
      </desc>
    </func>
    <func>
      <name name="send" arity="2"/>
      <fsummary>Send a message to all members of a process group</fsummary>
      <desc>
        <p>Sends the tuple <c>{pg_message, From, PgName, Msg}</c> to
          all members of the process group <c><anno>PgName</anno></c>.</p>
        <p>Failure: <c>{badarg, {<anno>PgName</anno>, <anno>Msg</anno>}}</c>
          if <c><anno>PgName</anno></c> is
          not a process group (a globally registered name).</p>
      </desc>
    </func>
    <func>
      <name name="esend" arity="2"/>
      <fsummary>Send a message to all members of a process group, except ourselves</fsummary>
      <desc>
        <p>Sends the tuple <c>{pg_message, From, PgName, Msg}</c> to
          all members of the process group <c><anno>PgName</anno></c>, except
          ourselves.</p>
        <p>Failure: <c>{badarg, {<anno>PgName</anno>, <anno>Msg</anno>}}</c>
          if <c><anno>PgName</anno></c> is
          not a process group (a globally registered name).</p>
      </desc>
    </func>
    <func>
      <name name="members" arity="1"/>
      <fsummary>Return a list of all members of a process group</fsummary>
      <desc>
        <p>Returns a list of all members of the process group
          <c>PgName</c>.</p>
      </desc>
    </func>
  </funcs>
</erlref>