aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/race_SUITE_data/src/ets_insert_new.erl
blob: 63f3272912b8eec3f7c7b806c2ff0b73c86cad23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
%% This tests the presence of possible races due to an ets:lookup/ets:insert
%% combination. It takes into account multiple ets:new calls that might exist.

-module(ets_insert_new).
-export([test/0]).

test() ->
  T1 = ets:new(foo, [public]),
  T2 = ets:new(bar, []),
  ets:lookup(T2, counter),
  aux(T1),
  aux(T2).

aux(Tab) ->
  ets:insert(Tab, {counter, 1}).