couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [42/50] rebar commit: updated refs/heads/import to 5dea85d
Date Wed, 23 Sep 2015 12:29:36 GMT
rmemo: support R13 for rebar only

ets read_concurrency has been available since R14, but rebar supports
R13B03 (and newer). As a workaround we check that erts/ebin/erts.app
exists as another pre-R14 characteristic to determine whether we can
assume read_concurrency is supported.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/242b52b8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/242b52b8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/242b52b8

Branch: refs/heads/import
Commit: 242b52b8d2d1b343a25cfbf1ff56aa9c7e32a56f
Parents: ec018cf
Author: Tuncer Ayaz <tuncer.ayaz@gmail.com>
Authored: Thu Jun 11 20:38:43 2015 +0200
Committer: Tuncer Ayaz <tuncer.ayaz@gmail.com>
Committed: Fri Jun 12 12:52:24 2015 +0200

----------------------------------------------------------------------
 src/rmemo.erl | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/242b52b8/src/rmemo.erl
----------------------------------------------------------------------
diff --git a/src/rmemo.erl b/src/rmemo.erl
index 752c811..1d872fc 100644
--- a/src/rmemo.erl
+++ b/src/rmemo.erl
@@ -180,14 +180,27 @@ init(_) ->
 
 -spec ets_tab() -> ets:tab().
 ets_tab() ->
+    ErtsApp = filename:join(code:lib_dir(erts, ebin), "erts.app"),
+    Concurrency =
+        %% If erts.app exists, we run on at least R14. That means we
+        %% can use ets read_concurrency.
+        %% TODO: Remove and revert to vanilla memo.erl from
+        %% https://github.com/tuncer/memo once we require at least
+        %% R14B and drop support for R13.
+        case filelib:is_regular(ErtsApp) of
+            true ->
+                [{read_concurrency, true}];
+            false ->
+                []
+        end,
     ets:new(
       ?TABLE,
       [
        named_table,
        protected,
-       set,
-       {read_concurrency, true}
+       set
       ]
+      ++ Concurrency
      ).
 
 %%--------------------------------------------------------------------


Mime
View raw message