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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
<TITLE>pg</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.REFBODY { margin-left: 13mm }
.REFTYPES { margin-left: 8mm }
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
<IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>pg</H1>
</CENTER>
<H3>MODULE</H3>
<DIV CLASS=REFBODY>
pg
</DIV>
<H3>MODULE SUMMARY</H3>
<DIV CLASS=REFBODY>
Distributed, Named Process Groups
</DIV>
<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>
<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 <CODE>foobar</CODE> can include a set
of processes as members of this group and they can be located on
different nodes.
<P> When messages are sent to the named group, all members of
the group receive the message. The messages are serialized. If
the process <CODE>P1</CODE> sends the message <CODE>M1</CODE> to the group,
and process <CODE>P2</CODE> simultaneously sends message <CODE>M2</CODE>, 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>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.
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="create/1"><STRONG><CODE>create(PgName) -> ok | {error, Reason}</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>PgName = term()</CODE></STRONG><BR>
<STRONG><CODE>Reason = already_created | term()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Creates an empty group named <CODE>PgName</CODE> on the current
node.
</DIV>
<P><A NAME="create/2"><STRONG><CODE>create(PgName, Node) -> ok | {error, Reason}</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>PgName = term()</CODE></STRONG><BR>
<STRONG><CODE>Node = node()</CODE></STRONG><BR>
<STRONG><CODE>Reason = already_created | term()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Creates an empty group named <CODE>PgName</CODE> on the node
<CODE>Node</CODE>.
</DIV>
<P><A NAME="join/2"><STRONG><CODE>join(PgName, Pid) -> Members</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>PgName = term()</CODE></STRONG><BR>
<STRONG><CODE>Pid = pid()</CODE></STRONG><BR>
<STRONG><CODE>Members = [pid()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Joins the pid <CODE>Pid</CODE> to the process group <CODE>PgName</CODE>.
Returns a list of all old members of the group.
</DIV>
<P><A NAME="send/2"><STRONG><CODE>send(PgName, Msg) -> void()</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>PgName = Msg = term()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Sends the tuple <CODE>{pg_message, From, PgName, Msg}</CODE> to
all members of the process group <CODE>PgName</CODE>.
<P>Failure: <CODE>{badarg, {PgName, Msg}}</CODE> if <CODE>PgName</CODE> is
not a process group (a globally registered name).
</DIV>
<P><A NAME="esend/2"><STRONG><CODE>esend(PgName, Msg) -> void()</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>PgName = Msg = term()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Sends the tuple <CODE>{pg_message, From, PgName, Msg}</CODE> to
all members of the process group <CODE>PgName</CODE>, except
ourselves.
<P>Failure: <CODE>{badarg, {PgName, Msg}}</CODE> if <CODE>PgName</CODE> is
not a process group (a globally registered name).
</DIV>
<P><A NAME="members/1"><STRONG><CODE>members(PgName) -> Members</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>PgName = term()</CODE></STRONG><BR>
<STRONG><CODE>Members = [pid()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all members of the process group
<CODE>PgName</CODE>.
</DIV>
<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Claes Wikstrom - support@erlang.ericsson.se<BR>
</DIV>
<CENTER>
<HR>
<SMALL>stdlib 1.14.2<BR>
Copyright © 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|