diff options
author | Hans Bolinder <[email protected]> | 2019-06-26 14:47:30 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-07-02 09:00:27 +0200 |
commit | b81ebdf125a76c2ad3594eb37482a24137c502b6 (patch) | |
tree | 7d14cce731c168089d0a0b3564f25a8b92d7dda3 /lib/kernel | |
parent | 2203794ff61884704b86f86ac7284c9c306e018d (diff) | |
download | otp-b81ebdf125a76c2ad3594eb37482a24137c502b6.tar.gz otp-b81ebdf125a76c2ad3594eb37482a24137c502b6.tar.bz2 otp-b81ebdf125a76c2ad3594eb37482a24137c502b6.zip |
kernel: Correct a test case in global_SUITE
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/test/global_SUITE.erl | 13 |
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), |