From 6919515de596cf0af0ef6ad4c392dbb735616923 Mon Sep 17 00:00:00 2001 From: Gregory Burd Date: Fri, 2 Aug 2013 14:18:19 -0400 Subject: [PATCH] Re-use the unchanging value of 'Args' rather than including it in every recursive call. --- src/async_nif.hrl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/async_nif.hrl b/src/async_nif.hrl index 192ee36..b8f7be3 100644 --- a/src/async_nif.hrl +++ b/src/async_nif.hrl @@ -22,9 +22,9 @@ %% ------------------------------------------------------------------- -define(ASYNC_NIF_CALL(Fun, Args), - F = fun(F, A, T) -> + F = fun(F, T) -> R = erlang:make_ref(), - case erlang:apply(F, [R|A]) of + case erlang:apply(F, [R|Args]) of {ok, enqueued} -> receive {R, {error, shutdown}=Error} -> @@ -39,9 +39,9 @@ {error, eagain} -> SleepyTime = min(30, (T+1)*2), timer:sleep(SleepyTime), - F(F, A, SleepyTime); + F(F, SleepyTime); Other -> Other end end, - F(Fun, Args, 0)). + F(Fun, 0)).