blob: 7bcde321a1376ea7de1b2b5cc528584ca6150d91 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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.
|