1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
<year>1996</year>
<year>2013</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>
|