aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-02-26 16:30:05 +0100
committerSverker Eriksson <[email protected]>2013-02-26 16:30:05 +0100
commit4d22480802f12bc94a3d0a076f0038b566bb104f (patch)
tree38b89dfa93543894310242c431a2143780b3fc3e
parent05f11890bdfec4bfc3a78e191a87e70a937ffc54 (diff)
downloadotp-4d22480802f12bc94a3d0a076f0038b566bb104f.tar.gz
otp-4d22480802f12bc94a3d0a076f0038b566bb104f.tar.bz2
otp-4d22480802f12bc94a3d0a076f0038b566bb104f.zip
stdlib: Remove race in ets_SUITE:delete_large_named_table
-rw-r--r--lib/stdlib/test/ets_SUITE.erl15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl
index b6c94a6f6d..d0478fdeac 100644
--- a/lib/stdlib/test/ets_SUITE.erl
+++ b/lib/stdlib/test/ets_SUITE.erl
@@ -3242,7 +3242,7 @@ delete_large_tab_1(Name, Flags, Data, Fix) ->
delete_large_named_table(doc) ->
"Delete a large name table and try to create a new table with the same name in another process.";
delete_large_named_table(Config) when is_list(Config) ->
- ?line Data = [{erlang:phash2(I, 16#ffffff),I} || I <- lists:seq(1, 500000)],
+ ?line Data = [{erlang:phash2(I, 16#ffffff),I} || I <- lists:seq(1, 200000)],
?line EtsMem = etsmem(),
repeat_for_opts(fun(Opts) -> delete_large_named_table_do(Opts,Data) end),
?line verify_etsmem(EtsMem),
@@ -3264,16 +3264,17 @@ delete_large_named_table_1(Name, Flags, Data, Fix) ->
?line lists:foreach(fun({K,_}) -> ets:delete(Tab, K) end, Data)
end,
Parent = self(),
- Pid = my_spawn_link(fun() ->
- receive
- {trace,Parent,call,_} ->
- ets_new(Name, [named_table])
- end
- end),
+ {Pid, MRef} = my_spawn_opt(fun() ->
+ receive
+ {trace,Parent,call,_} ->
+ ets_new(Name, [named_table])
+ end
+ end, [link, monitor]),
?line erlang:trace(self(), true, [call,{tracer,Pid}]),
?line erlang:trace_pattern({ets,delete,1}, true, [global]),
?line erlang:yield(), true = ets:delete(Tab),
?line erlang:trace_pattern({ets,delete,1}, false, [global]),
+ receive {'DOWN',MRef,process,Pid,_} -> ok end,
ok.
evil_delete(doc) ->