diff options
author | Stavros Aronis <[email protected]> | 2012-09-05 18:25:48 +0200 |
---|---|---|
committer | Stavros Aronis <[email protected]> | 2012-09-26 11:06:43 +0200 |
commit | 5e766039bb990ac17a9559301ad1599e250bf9e7 (patch) | |
tree | 4cb107d4f12ee360332c330d4b0367c757f49ca8 /lib/dialyzer/test/race_SUITE_data/src | |
parent | fc17b0ed2bc905b51ed4c4ea5f13efd866bc4f80 (diff) | |
download | otp-5e766039bb990ac17a9559301ad1599e250bf9e7.tar.gz otp-5e766039bb990ac17a9559301ad1599e250bf9e7.tar.bz2 otp-5e766039bb990ac17a9559301ad1599e250bf9e7.zip |
Fix a crash in race condition detection
Analysis is not always able to find the variable labels and names for any kind
of arguments passed to the ets module functions.
Diffstat (limited to 'lib/dialyzer/test/race_SUITE_data/src')
-rw-r--r-- | lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl b/lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl new file mode 100644 index 0000000000..c897a34af0 --- /dev/null +++ b/lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl @@ -0,0 +1,19 @@ +%% This tests the presence of possible races due to an ets:lookup/ets:insert +%% combination. It takes into account the argument types of the calls. + +-module(ets_insert_args10). +-export([start/0]). + +start() -> + F = fun(T) -> [{_, N}] = ets:lookup(T, counter), + ets:insert(T, [{counter, N+1}]) + end, + io:format("Created ~w\n", [ets:new(foo, [named_table, public])]), + A = {counter, 0}, + B = [], + ets:insert(foo, [A|B]), + io:format("Inserted ~w\n", [{counter, 0}]), + F(foo), + io:format("Update complete\n", []), + ObjectList = ets:lookup(foo, counter), + io:format("Counter: ~w\n", [ObjectList]). |