You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gproc has two dependencies: `gen_leader` and `edown`. Since most people don't
14
13
actively use either, they are no longer fetched by default.
14
+
15
15
* To enable fetching of `gen_leader`, export the OS environment variable`GPROC_DIST=true` (this can be done e.g. from a GNU Makefile)
16
16
17
17
*`edown` is fetched on-demand whenver `rebar get-deps doc` is called (which
18
18
happens when you call `make doc`)
19
19
20
20
21
21
22
-
##Introduction##
23
-
22
+
## Introduction ##
24
23
25
24
Gproc is a process dictionary for Erlang, which provides a number of useful features beyond what the built-in dictionary has:
25
+
26
26
* Use any term as a process alias
27
27
28
28
* Register a process under several aliases
@@ -43,31 +43,34 @@ Gproc is a process dictionary for Erlang, which provides a number of useful feat
43
43
44
44
45
45
46
-
###Use case: System inspection##
47
-
46
+
### Use case: System inspection ###
48
47
49
48
Gproc was designed to work as a central index for "process metadata", i.e.
50
49
properties that describe the role and characteristics of each process. Having
51
50
a single registry that is flexible enough to hold important types of property
52
51
makes it easier to (a) find processes of a certain type, and (b) query and
53
52
browse key data in a running system.
54
53
55
-
###Use case: Pub/Sub patterns##
56
54
55
+
### Use case: Pub/Sub patterns ###
57
56
58
57
An interesting application of gproc is building publish/subscribe patterns.
59
-
Example:<pre>
58
+
Example:
59
+
60
+
```erlang
61
+
60
62
subscribe(EventType) ->
61
63
%% Gproc notation: {p, l, Name} means {(p)roperty, (l)ocal, Name}
62
64
gproc:reg({p, l, {?MODULE, EventType}}).
63
65
64
66
notify(EventType, Msg) ->
65
67
Key= {?MODULE, EventType},
66
68
gproc:send({p, l, Key}, {self(), Key, Msg}).
67
-
</pre>
68
69
69
-
###Use case: Environment handling##
70
+
```
71
+
70
72
73
+
### Use case: Environment handling ###
71
74
72
75
Gproc provides a set of functions to read environment variables, possibly from
73
76
alternative sources, and cache them for efficient lookup. Caching also provides
@@ -77,8 +80,8 @@ which values they actually ended up using.
77
80
See [`gproc:get_env/4`](https://github.com/esl/gproc/blob/master/doc/gproc.md#get_env-4), [`gproc:get_set_env/4`](https://github.com/esl/gproc/blob/master/doc/gproc.md#get_set_env-4) and
78
81
[`gproc:set_env/5`](https://github.com/esl/gproc/blob/master/doc/gproc.md#set_env-5) for details.
79
82
80
-
##Testing##
81
83
84
+
## Testing ##
82
85
83
86
Gproc has a QuickCheck test suite, covering a fairly large part of the local
84
87
gproc functionality, although none of the global registry. It requires a
@@ -88,16 +91,17 @@ available, and if it isn't, the code in gproc_eqc.erl will be "defined away".
88
91
There is also an eunit suite, covering the basic operations for local and
89
92
global gproc.
90
93
91
-
##Building Edoc##
92
94
95
+
## Building Edoc ##
93
96
94
97
95
98
By default, `./rebar doc` generates Github-flavored Markdown files.
96
-
If you want to change this, remove the `edoc_opts` line from `rebar.config`.Gproc was first introduced at the ACM SIGPLAN Erlang Workshop in
99
+
If you want to change this, remove the `edoc_opts` line from `rebar.config`.
100
+
Gproc was first introduced at the ACM SIGPLAN Erlang Workshop in
97
101
Freiburg 2007 ([Paper available here](https://github.com/esl/gproc/blob/master/doc/erlang07-wiger.pdf)).
98
102
99
103
100
-
##Modules##
104
+
##Modules##
101
105
102
106
103
107
<tablewidth="100%"border="0"summary="list of modules">
@@ -109,6 +113,7 @@ Freiburg 2007 ([Paper available here](https://github.com/esl/gproc/blob/master/do
0 commit comments