File: pg.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (112 lines) | stat: -rw-r--r-- 2,586 bytes parent folder | download
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
112
.TH pg 3 "stdlib  1.15.3" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
pg \- Distributed, Named Process Groups
.SH DESCRIPTION
.LP
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 \fIfoobar\fR can include a set of processes as members of this group and they can be located on different nodes\&.
.LP
When messages are sent to the named group, all members of the group receive the message\&. The messages are serialized\&. If the process \fIP1\fR sends the message \fIM1\fR to the group, and process \fIP2\fR simultaneously sends message \fIM2\fR, 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\&.
.LP
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\&.

.SH EXPORTS
.LP
.B
create(PgName) -> ok | {error, Reason}
.br
.RS
.TP
Types
PgName = term()
.br
Reason = already_created | term()
.br
.RE
.RS
.LP
Creates an empty group named \fIPgName\fR on the current node\&.
.RE
.LP
.B
create(PgName, Node) -> ok | {error, Reason}
.br
.RS
.TP
Types
PgName = term()
.br
Node = node()
.br
Reason = already_created | term()
.br
.RE
.RS
.LP
Creates an empty group named \fIPgName\fR on the node \fINode\fR\&.
.RE
.LP
.B
join(PgName, Pid) -> Members
.br
.RS
.TP
Types
PgName = term()
.br
Pid = pid()
.br
Members = [pid()]
.br
.RE
.RS
.LP
Joins the pid \fIPid\fR to the process group \fIPgName\fR\&. Returns a list of all old members of the group\&.
.RE
.LP
.B
send(PgName, Msg) -> void()
.br
.RS
.TP
Types
PgName = Msg = term()
.br
.RE
.RS
.LP
Sends the tuple \fI{pg_message, From, PgName, Msg}\fR to all members of the process group \fIPgName\fR\&.
.LP
Failure: \fI{badarg, {PgName, Msg}}\fR if \fIPgName\fR is not a process group (a globally registered name)\&.
.RE
.LP
.B
esend(PgName, Msg) -> void()
.br
.RS
.TP
Types
PgName = Msg = term()
.br
.RE
.RS
.LP
Sends the tuple \fI{pg_message, From, PgName, Msg}\fR to all members of the process group \fIPgName\fR, except ourselves\&.
.LP
Failure: \fI{badarg, {PgName, Msg}}\fR if \fIPgName\fR is not a process group (a globally registered name)\&.
.RE
.LP
.B
members(PgName) -> Members
.br
.RS
.TP
Types
PgName = term()
.br
Members = [pid()]
.br
.RE
.RS
.LP
Returns a list of all members of the process group \fIPgName\fR\&.
.RE