aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2019-08-19 12:53:46 +0200
committerHans Bolinder <[email protected]>2019-08-19 12:53:46 +0200
commitd14919b70af5d08970f0e92aded2b375a79f4d94 (patch)
treed467d8e047201087a59b9c15f73a4831d349d4e9
parenta536cb2201d7d0d35408799a0f126afd7064a1c3 (diff)
parentb81ebdf125a76c2ad3594eb37482a24137c502b6 (diff)
downloadotp-d14919b70af5d08970f0e92aded2b375a79f4d94.tar.gz
otp-d14919b70af5d08970f0e92aded2b375a79f4d94.tar.bz2
otp-d14919b70af5d08970f0e92aded2b375a79f4d94.zip
Merge branch 'hasse/kernel/global_tests' into maint
* hasse/kernel/global_tests: kernel: Correct a test case in global_SUITE
-rw-r--r--lib/kernel/test/global_SUITE.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/kernel/test/global_SUITE.erl b/lib/kernel/test/global_SUITE.erl
index 8eab36e308..5bff9cc292 100644
--- a/lib/kernel/test/global_SUITE.erl
+++ b/lib/kernel/test/global_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2018. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2019. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -2512,8 +2512,10 @@ re_register_name(Config) when is_list(Config) ->
Me = self(),
Pid1 = spawn(fun() -> proc(Me) end),
yes = global:register_name(name, Pid1),
+ wait_for_monitor(Pid1),
Pid2 = spawn(fun() -> proc(Me) end),
_ = global:re_register_name(name, Pid2),
+ wait_for_monitor(Pid2),
Pid2 ! die,
Pid1 ! die,
receive {Pid1, MonitoredBy1} -> [] = MonitoredBy1 end,
@@ -2522,6 +2524,15 @@ re_register_name(Config) when is_list(Config) ->
init_condition(Config),
ok.
+wait_for_monitor(Pid) ->
+ case process_info(Pid, monitored_by) of
+ {monitored_by, []} ->
+ timer:sleep(1),
+ wait_for_monitor(Pid);
+ {monitored_by, [_]} ->
+ ok
+ end.
+
proc(Parent) ->
receive die -> ok end,
{monitored_by, MonitoredBy} = process_info(self(), monitored_by),