Re-use the unchanging value of 'Args' rather than including it in every recursive call.
This commit is contained in:
parent
05c8c615ef
commit
96d43d5d17
1 changed files with 4 additions and 4 deletions
|
@ -22,9 +22,9 @@
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
|
|
||||||
-define(ASYNC_NIF_CALL(Fun, Args),
|
-define(ASYNC_NIF_CALL(Fun, Args),
|
||||||
F = fun(F, A, T) ->
|
F = fun(F, T) ->
|
||||||
R = erlang:make_ref(),
|
R = erlang:make_ref(),
|
||||||
case erlang:apply(F, [R|A]) of
|
case erlang:apply(F, [R|Args]) of
|
||||||
{ok, enqueued} ->
|
{ok, enqueued} ->
|
||||||
receive
|
receive
|
||||||
{R, {error, shutdown}=Error} ->
|
{R, {error, shutdown}=Error} ->
|
||||||
|
@ -39,9 +39,9 @@
|
||||||
{error, eagain} ->
|
{error, eagain} ->
|
||||||
SleepyTime = min(30, (T+1)*2),
|
SleepyTime = min(30, (T+1)*2),
|
||||||
timer:sleep(SleepyTime),
|
timer:sleep(SleepyTime),
|
||||||
F(F, A, SleepyTime);
|
F(F, SleepyTime);
|
||||||
Other ->
|
Other ->
|
||||||
Other
|
Other
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
F(Fun, Args, 0)).
|
F(Fun, 0)).
|
||||||
|
|
Loading…
Reference in a new issue