Browse Source

clean up error on repeated gproc_pool:new()

Ulf Wiger 11 years ago
parent
commit
2fa3811eae
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/gproc_pool.erl

+ 5 - 2
src/gproc_pool.erl

@@ -534,7 +534,6 @@ handle_call(Req, From, S) ->
     try handle_call_(Req, From, S)
     catch
         error:Reason ->
-            io:fwrite("server backtrace: ~p~n", [erlang:get_stacktrace()]),
             {reply, {badarg, Reason}, S}
     end.
 
@@ -590,7 +589,11 @@ new_(Pool, Type, Opts) ->
     valid_type(Type),
     Size = proplists:get_value(size, Opts, 0),
     Workers = lists:seq(1, Size),
-    gproc:reg_shared(K = ?POOL(Pool), {Size, Type}),
+    K = ?POOL(Pool),
+    try gproc:reg_shared(K, {Size, Type})
+    catch
+        error:_ -> error(exists)
+    end,
     Opts1 =
         case lists:keyfind(auto_size, 1, Opts) of
             false ->