Skip to content

Commit

Permalink
deprecated erlang:get_stacktrace/0 function
Browse files Browse the repository at this point in the history
  • Loading branch information
getong committed Jul 14, 2018
1 parent e761d77 commit 5d40cc5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/poolboy.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
-type pid_queue() :: queue:queue().
-endif.

-ifdef(OTP_RELEASE). %% this implies 21 or higher
-define(EXCEPTION(Class, Reason, Stacktrace), Class:Reason:Stacktrace).
-define(GET_STACK(Stacktrace), Stacktrace).
-else.
-define(EXCEPTION(Class, Reason, _), Class:Reason).
-define(GET_STACK(_), erlang:get_stacktrace()).
-endif.

-type pool() ::
Name :: (atom() | pid()) |
{Name :: atom(), node()} |
Expand Down Expand Up @@ -54,9 +62,9 @@ checkout(Pool, Block, Timeout) ->
try
gen_server:call(Pool, {checkout, CRef, Block}, Timeout)
catch
Class:Reason ->
?EXCEPTION(Class, Reason, Stacktrace) ->
gen_server:cast(Pool, {cancel_waiting, CRef}),
erlang:raise(Class, Reason, erlang:get_stacktrace())
erlang:raise(Class, Reason, ?GET_STACK(Stacktrace))
end.

-spec checkin(Pool :: pool(), Worker :: pid()) -> ok.
Expand Down

0 comments on commit 5d40cc5

Please sign in to comment.