1%% This tests that the race condition detection between whereis/unregister
2%% is robust w.r.t. having the calls in separate functions.
3
4-module(whereis_diff_functions3_nested).
5-export([test/1]).
6
7test(AnAtom) ->
8  start(AnAtom).
9
10start(AnAtom) ->
11  case whereis(AnAtom) of
12    undefined -> true;
13    P when is_pid(P) ->
14      race1(AnAtom)
15  end.
16
17race1(Atom) ->
18  race2(Atom).
19
20race2(Atom) ->
21  unregister(Atom).
22