Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:20
erlang
0957-erts-Cuddle-dirty_nif_SUITE-dirty_call_whi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0957-erts-Cuddle-dirty_nif_SUITE-dirty_call_while_termina.patch of Package erlang
From ddd50170a9c093b6c998fac2b74da4014102d943 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Thu, 16 Jan 2020 16:19:28 +0100 Subject: [PATCH] erts: Cuddle dirty_nif_SUITE:dirty_call_while_terminated --- erts/emulator/test/dirty_nif_SUITE.erl | 48 +++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/erts/emulator/test/dirty_nif_SUITE.erl b/erts/emulator/test/dirty_nif_SUITE.erl index 6f5ec161a3..8e5e2ded6e 100644 --- a/erts/emulator/test/dirty_nif_SUITE.erl +++ b/erts/emulator/test/dirty_nif_SUITE.erl @@ -226,18 +226,21 @@ dirty_call_while_terminated(Config) when is_list(Config) -> element(2, process_info(self(), binary))), - receive after 2000 -> ok end, receive Msg -> ct:fail({unexpected_message, Msg}) after - 0 -> + 1000 -> ok end, - {value, {BinAddr, 4711, 1}} = lists:keysearch(4711, 2, - element(2, - process_info(self(), - binary))), + ok = wait_until(fun() -> + {value, {BinAddr, 4711, 1}} == + lists:keysearch(4711, 2, + element(2, + process_info(self(), + binary))) + end, + 10000), process_flag(trap_exit, OT), try blipp:blupp(Bin) @@ -714,6 +717,39 @@ nif_whereis_proxy(Ref) -> ok end. +wait_until(Fun, infinity) -> + wait_until_aux(Fun, infinity); +wait_until(Fun, MaxTime) -> + End = erlang:monotonic_time(millisecond) + MaxTime, + wait_until_aux(Fun, End). + +wait_until_aux(Fun, End) -> + case Fun() of + true -> + ok; + _ -> + if End == infinity -> + receive after 100 -> ok end, + wait_until_aux(Fun, infinity); + true -> + Now = erlang:monotonic_time(millisecond), + case End =< Now of + true -> + timeout; + _ -> + Wait = case End - Now of + Short when End - Now < 100 -> + Short; + _ -> + 100 + end, + receive after Wait -> ok end, + wait_until_aux(Fun, End) + end + end + end. + + %% The NIFs: lib_loaded() -> false. call_dirty_nif(_,_,_) -> ?nif_stub. -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor