Selective receive requires that the ref is created in the scope of the receive.

This commit is contained in:
Gregory Burd 2013-07-30 12:53:33 -04:00
parent e9f9d13e47
commit 45037cbcca

View file

@ -22,7 +22,8 @@
%% -------------------------------------------------------------------
-spec async_nif_enqueue(reference(), function(), [term()]) -> term() | {error, term()}.
async_nif_enqueue(R, F, A) ->
async_nif_enqueue(F, A) ->
R = erlang:make_ref(),
case erlang:apply(F, [R|A]) of
{ok, enqueued} ->
receive
@ -44,4 +45,4 @@ async_nif_enqueue(R, F, A) ->
Other
end.
-define(ASYNC_NIF_CALL(Fun, Args), async_nif_enqueue(erlang:make_ref(), Fun, Args)).
-define(ASYNC_NIF_CALL(Fun, Args), async_nif_enqueue(Fun, Args)).