aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_try_catch.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dialyzer/test/race_tests_SUITE_data/src/whereis_try_catch.erl')
-rw-r--r--lib/dialyzer/test/race_tests_SUITE_data/src/whereis_try_catch.erl25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_try_catch.erl b/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_try_catch.erl
new file mode 100644
index 0000000000..9c8daf8d8c
--- /dev/null
+++ b/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_try_catch.erl
@@ -0,0 +1,25 @@
+% This tests that warnings do appear when a whereis/register combination
+% is handled by try/catch.
+
+-module(whereis_try_catch).
+-export([race/1, no_race/1]).
+
+race(Pid) ->
+ case whereis(master) of
+ undefined ->
+ try
+ io:format("exception", [])
+ catch
+ _ -> register(master, Pid)
+ end
+ end.
+
+no_race(Pid) ->
+ case whereis(master) of
+ undefined ->
+ try
+ register(master, Pid)
+ catch
+ _ -> io:format("exception", [])
+ end
+ end.