summaryrefslogtreecommitdiff
path: root/lib/dialyzer/test/race_SUITE_data/src/whereis_intra_inter_module5/whereis_intra_inter_module10.erl
blob: 7ed50ea742b0544f96dc3f6fa5cec132d7b3499a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
%% This tests that the race condition detection between whereis/register
%% is robust w.r.t. having the calls in separate functions and modules.

-module(whereis_intra_inter_module10).
-export([continue/2]).

continue(AnAtom, Fun) ->
  aux(AnAtom, Fun).

aux(AnAtom, Fun) ->
  case whereis(AnAtom) of
    undefined ->
      Pid = spawn(Fun);
    P when is_pid(P) ->
      P
  end.