Permalink
Browse files

'make check' for dialyzer analysis

  • Loading branch information...
Ulf Wiger
Ulf Wiger committed May 20, 2011
1 parent 75f0298 commit 6ebc97768ff69ae966de478c34deb6cb61b51e44
Showing with 149 additions and 17 deletions.
  1. +7 −2 Makefile
  2. +120 −1 doc/gproc_lib.md
  3. BIN rebar
  4. +5 −0 rebar.config
  5. +5 −11 src/gproc.erl
  6. +12 −2 src/gproc_lib.erl
  7. +0 −1 test/gproc_dist_tests.erl
View
@@ -20,12 +20,14 @@
## FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
## DEALINGS IN THE SOFTWARE.
-.PHONY: all compile clean eunit test eqc doc
+.PHONY: all compile clean eunit test eqc doc check dialyzer
DIRS=src
all: compile eunit test doc
+check: compile dialyzer
+
compile:
./rebar compile
@@ -39,4 +41,7 @@ eunit:
test: eunit
doc:
- ./rebar doc
+ ./rebar doc
+
+dialyzer:
+ ./rebar skip_deps=true dialyze
View
@@ -5,6 +5,8 @@ Module gproc_lib
<h1>Module gproc_lib</h1>
* [Description](#description)
+* [Function Index](#index)
+* [Function Details](#functions)
Extended process registry.
@@ -20,4 +22,121 @@ __Authors:__ Ulf Wiger ([`ulf.wiger@ericsson.com`](mailto:ulf.wiger@ericsson.com
This module implements an extended process registry
-For a detailed description, see gproc/doc/erlang07-wiger.pdf.
+For a detailed description, see gproc/doc/erlang07-wiger.pdf.
+
+<h2><a name="index">Function Index</a></h2>
+
+
+
+<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#await-3">await/3</a></td><td></td></tr><tr><td valign="top"><a href="#do_set_counter_value-3">do_set_counter_value/3</a></td><td></td></tr><tr><td valign="top"><a href="#do_set_value-3">do_set_value/3</a></td><td></td></tr><tr><td valign="top"><a href="#ensure_monitor-2">ensure_monitor/2</a></td><td></td></tr><tr><td valign="top"><a href="#insert_many-4">insert_many/4</a></td><td></td></tr><tr><td valign="top"><a href="#insert_reg-4">insert_reg/4</a></td><td></td></tr><tr><td valign="top"><a href="#remove_many-4">remove_many/4</a></td><td></td></tr><tr><td valign="top"><a href="#remove_reg-2">remove_reg/2</a></td><td></td></tr><tr><td valign="top"><a href="#update_aggr_counter-3">update_aggr_counter/3</a></td><td></td></tr><tr><td valign="top"><a href="#update_counter-3">update_counter/3</a></td><td></td></tr></table>
+
+
+
+
+<h2><a name="functions">Function Details</a></h2>
+
+
+<a name="await-3"></a>
+
+<h3>await/3</h3>
+
+
+
+
+
+`await(Key, WPid, From) -> any()`
+
+<a name="do_set_counter_value-3"></a>
+
+<h3>do_set_counter_value/3</h3>
+
+
+
+
+
+`do_set_counter_value(Key, Value, Pid) -> any()`
+
+<a name="do_set_value-3"></a>
+
+<h3>do_set_value/3</h3>
+
+
+
+
+
+`do_set_value(Key, Value, Pid) -> any()`
+
+<a name="ensure_monitor-2"></a>
+
+<h3>ensure_monitor/2</h3>
+
+
+
+
+
+`ensure_monitor(Pid, Scope) -> any()`
+
+<a name="insert_many-4"></a>
+
+<h3>insert_many/4</h3>
+
+
+
+
+
+<pre>insert_many(T::<a href="#type-type">type()</a>, Scope::<a href="#type-scope">scope()</a>, KVL::[{<a href="#type-key">key()</a>, any()}], Pid::pid()) -> {true, list()} | false</pre>
+<br></br>
+
+
+<a name="insert_reg-4"></a>
+
+<h3>insert_reg/4</h3>
+
+
+
+
+
+<pre>insert_reg(K::<a href="#type-key">key()</a>, Value::any(), Pid::pid(), Scope::<a href="#type-scope">scope()</a>) -> boolean()</pre>
+<br></br>
+
+
+<a name="remove_many-4"></a>
+
+<h3>remove_many/4</h3>
+
+
+
+
+
+`remove_many(T, Scope, L, Pid) -> any()`
+
+<a name="remove_reg-2"></a>
+
+<h3>remove_reg/2</h3>
+
+
+
+
+
+`remove_reg(Key, Pid) -> any()`
+
+<a name="update_aggr_counter-3"></a>
+
+<h3>update_aggr_counter/3</h3>
+
+
+
+
+
+`update_aggr_counter(C, N, Val) -> any()`
+
+<a name="update_counter-3"></a>
+
+<h3>update_counter/3</h3>
+
+
+
+
+
+`update_counter(Key, Incr, Pid) -> any()`
+
View
BIN rebar
Binary file not shown.
View
@@ -5,6 +5,11 @@
{gen_leader, ".*",
{git, "git://github.com/abecciu/gen_leader_revival.git", "HEAD"}}
]}.
+{dialyzer_opts, [{warnings, [no_unused,
+ no_improper_lists, no_fun_app, no_match,
+ no_opaque, no_fail_call,
+ error_handling, no_match,
+ behaviours, underspecs]}]}.
{edoc_opts, [{doclet, edown_doclet},
{top_level_readme,
{"./README.md",
View
@@ -774,7 +774,7 @@ local_mreg(T, [_|_] = KVL) ->
end.
local_munreg(T, L) when T==p; T==c ->
- _ = [gproc_lib:remove_reg({T,l,K}) || K <- L],
+ _ = [gproc_lib:remove_reg({T,l,K}, self()) || K <- L],
true.
%% @spec (Key :: key(), Value) -> true
@@ -1280,12 +1280,12 @@ try_insert_reg({T,l,_} = Key, Val, Pid) ->
-spec audit_process(pid()) -> ok.
audit_process(Pid) when is_pid(Pid) ->
- gen_server:call(gproc, {audit_process, Pid}, infinity).
+ ok = gen_server:call(gproc, {audit_process, Pid}, infinity).
-spec process_is_down(pid()) -> ok.
-process_is_down(Pid) ->
+process_is_down(Pid) when is_pid(Pid) ->
%% delete the monitor marker
%% io:fwrite(user, "process_is_down(~p) - ~p~n", [Pid,ets:tab2list(?TAB)]),
ets:delete(?TAB, {Pid,l}),
@@ -1592,7 +1592,7 @@ table(Context) ->
%% See [http://www.erlang.org/doc/man/qlc.html].
%% @end
table(Context, Opts) ->
- Ctxt = get_s_t(Context),
+ Ctxt = {_, Type} = get_s_t(Context),
[Traverse, NObjs] = [proplists:get_value(K,Opts,Def) ||
{K,Def} <- [{traverse,select}, {n_objects,100}]],
TF = case Traverse of
@@ -1607,7 +1607,7 @@ table(Context, Opts) ->
erlang:error(badarg, [Ctxt,Opts])
end,
InfoFun = fun(indices) -> [2];
- (is_unique_objects) -> is_unique(Ctxt);
+ (is_unique_objects) -> is_unique(Type);
(keypos) -> 1;
(is_sorted_key) -> true;
(num_of_objects) ->
@@ -1675,13 +1675,7 @@ qlc_select({Objects, Cont}) ->
Objects ++ fun() -> qlc_select(ets:select(Cont)) end.
-is_unique(names) -> true;
-is_unique(aggr_counters) -> true;
-is_unique({_, names}) -> true;
-is_unique({_, aggr_counters}) -> true;
is_unique(n) -> true;
is_unique(a) -> true;
-is_unique({_,n}) -> true;
-is_unique({_,a}) -> true;
is_unique(_) -> false.
View
@@ -20,7 +20,17 @@
%% <p>For a detailed description, see gproc/doc/erlang07-wiger.pdf.</p>
%% @end
-module(gproc_lib).
--compile(export_all).
+
+-export([await/3,
+ do_set_counter_value/3,
+ do_set_value/3,
+ ensure_monitor/2,
+ insert_many/4,
+ insert_reg/4,
+ remove_many/4,
+ remove_reg/2,
+ update_aggr_counter/3,
+ update_counter/3]).
-include("gproc.hrl").
@@ -65,7 +75,7 @@ insert_reg({c,Scope,Ctr} = Key, Value, Pid, Scope) when Scope==l; Scope==g ->
ignore
end,
Res;
-insert_reg(Key, Value, Pid, _Scope) ->
+insert_reg({_,_,_} = Key, Value, Pid, _Scope) when is_pid(Pid) ->
%% Non-unique keys; store Pid in the key part
K = {Key, Pid},
Kr = {Pid, Key},
@@ -87,7 +87,6 @@ t_mreg([H|_] = Ns) ->
P = t_spawn_mreg(H, Kvl),
[?assertMatch(ok, t_lookup_everywhere({n,g,K}, Ns, P)) || K <- Keys],
?assertMatch(true, t_call(P, {apply, gproc, munreg, [n, g, Keys]})),
- timer:sleep(1000),
[?assertMatch(ok, t_lookup_everywhere({n,g,K},Ns,undefined)) || K <- Keys],
?assertMatch(ok, t_call(P, die)).

0 comments on commit 6ebc977

Please sign in to comment.