aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/nif_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-05-10 20:38:32 +0200
committerSverker Eriksson <[email protected]>2017-05-23 10:43:00 +0200
commit8543e7e6e92e0e15843f2ce0ea70513d421cd8ae (patch)
tree8a8ca9f9ccaea58db4a2471034b84fe8f7b53339 /erts/emulator/test/nif_SUITE.erl
parent42d240e9144bd6219c9fd3b59ef9bc4f29bcf5f5 (diff)
downloadotp-8543e7e6e92e0e15843f2ce0ea70513d421cd8ae.tar.gz
otp-8543e7e6e92e0e15843f2ce0ea70513d421cd8ae.tar.bz2
otp-8543e7e6e92e0e15843f2ce0ea70513d421cd8ae.zip
erts: Test monitor resource destructor from thread
which is scheduled on non-smp VM.
Diffstat (limited to 'erts/emulator/test/nif_SUITE.erl')
-rw-r--r--erts/emulator/test/nif_SUITE.erl15
1 files changed, 14 insertions, 1 deletions
diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl
index 1eb58699b2..0ae8e02011 100644
--- a/erts/emulator/test/nif_SUITE.erl
+++ b/erts/emulator/test/nif_SUITE.erl
@@ -629,6 +629,15 @@ monitor_process_a(Config) ->
monitor_process_b(Config) ->
ensure_lib_loaded(Config),
+ monitor_process_b_do(false),
+ case erlang:system_info(threads) of
+ true -> monitor_process_b_do(true);
+ false -> ok
+ end,
+ ok.
+
+
+monitor_process_b_do(FromThread) ->
Pid = spawn_link(fun() ->
receive
return -> ok
@@ -637,7 +646,10 @@ monitor_process_b(Config) ->
R_ptr = alloc_monitor_resource_nif(),
{0,_} = monitor_process_nif(R_ptr, Pid, true, self()),
[R_ptr] = monitored_by(Pid),
- ok = release_resource(R_ptr),
+ case FromThread of
+ false -> ok = release_resource(R_ptr);
+ true -> ok = release_resource_from_thread(R_ptr)
+ end,
[] = flush(),
{R_ptr, _, 1} = last_resource_dtor_call(),
[] = monitored_by(Pid),
@@ -2789,6 +2801,7 @@ alloc_resource(_,_) -> ?nif_stub.
make_resource(_) -> ?nif_stub.
get_resource(_,_) -> ?nif_stub.
release_resource(_) -> ?nif_stub.
+release_resource_from_thread(_) -> ?nif_stub.
last_resource_dtor_call() -> ?nif_stub.
make_new_resource(_,_) -> ?nif_stub.
check_is(_,_,_,_,_,_,_,_,_,_,_) -> ?nif_stub.