summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-10-28 14:42:11 +0100
committerSimon MacMullen <simon@rabbitmq.com>2011-10-28 14:42:11 +0100
commit3c5a49e31e7d434f3d6b6e4d5830a597fca211ef (patch)
tree933b4ad5c85407ed6e726028926a790c170006a5 /src
parentfb39b75030bfbeacda12f3ce19f7e9ab44d47422 (diff)
downloadrabbitmq-server-git-3c5a49e31e7d434f3d6b6e4d5830a597fca211ef.tar.gz
Send a ref
Diffstat (limited to 'src')
-rw-r--r--src/rabbit.erl19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 16af316145..90e95a9e07 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -255,27 +255,28 @@ hipe_compile() ->
[string:copies("-", Count)]),
T1 = erlang:now(),
S = self(),
- [spawn(fun () -> hipe_compile(S, Ms) end)
+ Ref = make_ref(),
+ [spawn(fun () -> hipe_compile(S, Ref, Ms) end)
|| Ms <- split(?HIPE_WORTHY, ?HIPE_PROCESSES)],
- wait(?HIPE_PROCESSES),
+ wait(Ref, ?HIPE_PROCESSES),
T2 = erlang:now(),
T = timer:now_diff(T2, T1) div 1000000,
io:format("|~n~nCompiled ~B modules in ~Bs~n", [Count, T]).
-wait(0) -> ok;
-wait(C) -> receive
- ok -> wait(C - 1);
- {error, E} -> exit(E)
- end.
+wait(_ , 0) -> ok;
+wait(Ref, C) -> receive
+ Ref -> wait(Ref, C - 1);
+ {error, E} -> exit(E)
+ end.
split(L, N) -> split0(L, [[] || _ <- lists:seq(1, N)]).
split0([], Ls) -> Ls;
split0([I | Is], [L | Ls]) -> split0(Is, Ls ++ [[I | L]]).
-hipe_compile(S, Ms) ->
+hipe_compile(S, Ref, Ms) ->
S ! try [hipe_compile(M) || M <- Ms],
- ok
+ Ref
catch _:E ->
{error, E}
end.