aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2017-10-09 08:59:32 +0200
committerJohn Högberg <[email protected]>2017-10-11 16:40:20 +0200
commit8ab02314baa4bf6fd1e3769b7222943a7084db28 (patch)
treed290cf472d4073979fbcf6485b137db7ab716c10 /lib/kernel
parent919ef5de2858e606d4a9be3e0e995b0802c76e33 (diff)
downloadotp-8ab02314baa4bf6fd1e3769b7222943a7084db28.tar.gz
otp-8ab02314baa4bf6fd1e3769b7222943a7084db28.tar.bz2
otp-8ab02314baa4bf6fd1e3769b7222943a7084db28.zip
Add zlib:set_controlling_process/2
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/zlib_SUITE.erl26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl
index d17eded811..1afcd155b3 100644
--- a/lib/kernel/test/zlib_SUITE.erl
+++ b/lib/kernel/test/zlib_SUITE.erl
@@ -978,23 +978,37 @@ split_bin(Last,Acc) ->
only_allow_owner(Config) when is_list(Config) ->
Z = zlib:open(),
+ Owner = self(),
?m(ok, zlib:inflateInit(Z)),
?m(ok, zlib:inflateReset(Z)),
{Pid, Ref} = spawn_monitor(
fun() ->
- ?m(?EXIT(not_on_controlling_process), zlib:inflateReset(Z))
+ ?m(?EXIT(not_on_controlling_process), zlib:inflateReset(Z)),
+ Owner ! '$transfer_ownership',
+ receive
+ '$ownership_transferred' ->
+ ?m(ok, zlib:inflateReset(Z))
+ after 200 ->
+ ct:fail("Never received transfer signal.")
+ end
end),
+ ownership_transfer_check(Z, Pid, Ref).
+ownership_transfer_check(Z, WorkerPid, Ref) ->
receive
- {'DOWN', Ref, process, Pid, _Reason} ->
- ok
+ '$transfer_ownership' ->
+ zlib:set_controlling_process(Z, WorkerPid),
+ WorkerPid ! '$ownership_transferred',
+ ownership_transfer_check(Z, WorkerPid, Ref);
+ {'DOWN', Ref, process, WorkerPid, normal} ->
+ ok;
+ {'DOWN', Ref, process, WorkerPid, Reason} ->
+ ct:fail("Spawned worker crashed with reason ~p.", [Reason])
after 200 ->
ct:fail("Spawned worker timed out.")
- end,
-
- ?m(ok, zlib:inflateReset(Z)).
+ end.
sub_heap_binaries(Config) when is_list(Config) ->
Compressed = zlib:compress(<<"gurka">>),