diff options
author | Rickard Green <[email protected]> | 2015-05-12 17:33:03 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2015-05-12 17:33:03 +0200 |
commit | 4030cfbb8de3445e80b3dcb3a1a45d0c6bac6483 (patch) | |
tree | 0d1208936003936433ba3793ee5b677dbc9d1697 /erts/emulator/test/after_SUITE.erl | |
parent | ff2400d7b5b1b090e128bc537d7bdd94c6aad97e (diff) | |
parent | 849a2ed2db2bd54422ec9284468f80cc86978974 (diff) | |
download | otp-4030cfbb8de3445e80b3dcb3a1a45d0c6bac6483.tar.gz otp-4030cfbb8de3445e80b3dcb3a1a45d0c6bac6483.tar.bz2 otp-4030cfbb8de3445e80b3dcb3a1a45d0c6bac6483.zip |
Merge branch 'rickard/timer-optimization/OTP-12650'
* rickard/timer-optimization/OTP-12650:
Timer fixes, documentation, and test cases
Conflicts:
erts/emulator/beam/erl_hl_timer.c
Diffstat (limited to 'erts/emulator/test/after_SUITE.erl')
-rw-r--r-- | erts/emulator/test/after_SUITE.erl | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/erts/emulator/test/after_SUITE.erl b/erts/emulator/test/after_SUITE.erl index 699a1436ce..c855481489 100644 --- a/erts/emulator/test/after_SUITE.erl +++ b/erts/emulator/test/after_SUITE.erl @@ -27,7 +27,8 @@ init_per_group/2,end_per_group/2, t_after/1, receive_after/1, receive_after_big/1, receive_after_errors/1, receive_var_zero/1, receive_zero/1, - multi_timeout/1, receive_after_32bit/1]). + multi_timeout/1, receive_after_32bit/1, + receive_after_blast/1]). -export([init_per_testcase/2, end_per_testcase/2]). @@ -40,7 +41,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [t_after, receive_after, receive_after_big, receive_after_errors, receive_var_zero, receive_zero, - multi_timeout, receive_after_32bit]. + multi_timeout, receive_after_32bit, receive_after_blast]. groups() -> []. @@ -244,4 +245,26 @@ recv_after_32bit(I, T) when I rem 2 =:= 0 -> receive after T -> exit(timeout) end; recv_after_32bit(_, _) -> receive after 16#ffffFFFF -> exit(timeout) end. - + +blaster() -> + receive + {go, TimeoutTime} -> + Tmo = TimeoutTime - erlang:monotonic_time(milli_seconds), + receive after Tmo -> ok end + end. + +spawn_blasters(0) -> + []; +spawn_blasters(N) -> + [spawn_monitor(fun () -> blaster() end)|spawn_blasters(N-1)]. + +receive_after_blast(Config) when is_list(Config) -> + PMs = spawn_blasters(10000), + TimeoutTime = erlang:monotonic_time(milli_seconds) + 5000, + lists:foreach(fun ({P, _}) -> P ! {go, TimeoutTime} end, PMs), + lists:foreach(fun ({P, M}) -> + receive + {'DOWN', M, process, P, normal} -> + ok + end + end, PMs). |