aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/race_SUITE_data/src/whereis_diff_functions3_nested.erl
blob: 5c28fc74f6499d46c0f0ca87466af464274e4280 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
%% This tests that the race condition detection between whereis/unregister
%% is robust w.r.t. having the calls in separate functions.

-module(whereis_diff_functions3_nested).
-export([test/1]).

test(AnAtom) ->
  start(AnAtom).

start(AnAtom) ->
  case whereis(AnAtom) of
    undefined -> true;
    P when is_pid(P) ->
      race1(AnAtom)
  end.

race1(Atom) ->
  race2(Atom).

race2(Atom) ->
  unregister(Atom).