Update Erlang glue to latest for async_nif as well.
This commit is contained in:
parent
e1fd403018
commit
5350c98169
1 changed files with 17 additions and 13 deletions
|
@ -1,32 +1,31 @@
|
||||||
%% ---------------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
%%
|
%%
|
||||||
%% async_nif: An async thread-pool layer for Erlang's NIF API
|
%% async_nif: An async thread-pool layer for Erlang's NIF API
|
||||||
%%
|
%%
|
||||||
%% Copyright (c) 2012-2013 Basho Technologies, Inc. All Rights Reserved.
|
%% Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved.
|
||||||
%% Author: Gregory Burd <greg@basho.com> <greg@burd.me>
|
%% Author: Gregory Burd <greg@basho.com> <greg@burd.me>
|
||||||
%%
|
%%
|
||||||
%% This file is provided to you under the Apache License, Version 2.0 (the
|
%% This file is provided to you under the Apache License,
|
||||||
%% "License"); you may not use this file except in compliance with the License.
|
%% Version 2.0 (the "License"); you may not use this file
|
||||||
%% You may obtain a copy of the License at:
|
%% except in compliance with the License. You may obtain
|
||||||
|
%% a copy of the License at
|
||||||
%%
|
%%
|
||||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||||
%%
|
%%
|
||||||
%% Unless required by applicable law or agreed to in writing, software
|
%% Unless required by applicable law or agreed to in writing,
|
||||||
%% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
%% software distributed under the License is distributed on an
|
||||||
%% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
%% License for the specific language governing permissions and limitations
|
%% KIND, either express or implied. See the License for the
|
||||||
|
%% specific language governing permissions and limitations
|
||||||
%% under the License.
|
%% under the License.
|
||||||
%%
|
%%
|
||||||
%% ---------------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
|
|
||||||
-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) ->
|
||||||
case erlang:apply(F, [R|A]) of
|
case erlang:apply(F, [R|A]) of
|
||||||
{ok, enqueued} ->
|
{ok, enqueued} ->
|
||||||
receive
|
receive
|
||||||
{R, {error, eagain}} ->
|
|
||||||
%% Work unit was not queued, try again.
|
|
||||||
async_nif_enqueue(R, F, A);
|
|
||||||
{R, {error, shutdown}=Error} ->
|
{R, {error, shutdown}=Error} ->
|
||||||
%% Work unit was queued, but not executed.
|
%% Work unit was queued, but not executed.
|
||||||
Error;
|
Error;
|
||||||
|
@ -36,6 +35,11 @@ async_nif_enqueue(R, F, A) ->
|
||||||
{R, Reply} ->
|
{R, Reply} ->
|
||||||
Reply
|
Reply
|
||||||
end;
|
end;
|
||||||
|
{error, eagain} ->
|
||||||
|
%% Work unit was not queued, try again.
|
||||||
|
async_nif_enqueue(R, F, A);
|
||||||
|
%{error, enomem} ->
|
||||||
|
%{error, shutdown} ->
|
||||||
Other ->
|
Other ->
|
||||||
Other
|
Other
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in a new issue