The ref needs to be in-scope of the recieve for it to be optimized.
This commit is contained in:
parent
8f415df69c
commit
27dba903ef
1 changed files with 2 additions and 1 deletions
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
-spec async_nif_enqueue(reference(), function(), [term()]) -> term() | {error, term()}.
|
-spec async_nif_enqueue(reference(), function(), [term()]) -> term() | {error, term()}.
|
||||||
async_nif_enqueue(R, F, A) ->
|
async_nif_enqueue(R, F, A) ->
|
||||||
|
R = erlang:make_ref(),
|
||||||
case erlang:apply(F, [R|A]) of
|
case erlang:apply(F, [R|A]) of
|
||||||
{ok, enqueued} ->
|
{ok, enqueued} ->
|
||||||
receive
|
receive
|
||||||
|
@ -44,4 +45,4 @@ async_nif_enqueue(R, F, A) ->
|
||||||
Other
|
Other
|
||||||
end.
|
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)).
|
||||||
|
|
Loading…
Reference in a new issue