aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_param.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dialyzer/test/race_tests_SUITE_data/src/whereis_param.erl')
-rw-r--r--lib/dialyzer/test/race_tests_SUITE_data/src/whereis_param.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_param.erl b/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_param.erl
new file mode 100644
index 0000000000..7bcde321a1
--- /dev/null
+++ b/lib/dialyzer/test/race_tests_SUITE_data/src/whereis_param.erl
@@ -0,0 +1,16 @@
+%% This tests the presence of possible races due to a whereis/register
+%% combination in higher order functions.
+
+-module(whereis_param).
+-export([start/2]).
+
+start(AnAtom, Fun) ->
+ register(AnAtom, continue(AnAtom, Fun)).
+
+continue(AnAtom, Fun) ->
+ case whereis(AnAtom) of
+ undefined ->
+ Pid = spawn(Fun);
+ P when is_pid(P) ->
+ P
+ end.