Skip to content

Commit

Permalink
ets utility header to check availability of concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
davidklaftenegger committed Mar 3, 2014
1 parent 88de506 commit 9e30a05
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions benchutil/ets.hrl
@@ -0,0 +1,23 @@
-define(READ_CONCURRENCY_VERSION, "R14B").
-define(WRITE_CONCURRENCY_VERSION, "R13B02").

supports_ets_concurrency(Version) ->
FunErlangVersionGreaterEqual =
fun([X1|_] = X, [Y1|_] = Y) ->
case {X1, Y1} of
{A, A} -> X >= Y;
{$R, _} -> false;
{_, $R} -> true;
{_, _} -> X >= Y % for versions > 19
end
end,
ReadConc = FunErlangVersionGreaterEqual(Version, ?READ_CONCURRENCY_VERSION),
WriteConc = FunErlangVersionGreaterEqual(Version, ?WRITE_CONCURRENCY_VERSION),
{ReadConc, WriteConc}.

%supports_ets_read_concurrency(Version) ->
% {X, _} = supports_ets_concurrency(Version),
% X.
%supports_ets_write_concurrency(Version) ->
% {_, X} = supports_ets_concurrency(Version),
% X.

0 comments on commit 9e30a05

Please sign in to comment.