aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-08-12 11:42:58 +0200
committerLukas Larsson <[email protected]>2016-08-12 11:42:58 +0200
commit6c41e0910b2ccb12c7a431f4398a7d0213b5b02e (patch)
treea236fd9fb3ab5967ff30f4f99bcaf56bc3c27cc6 /lib/kernel
parentdaa0f831aee9dedf8cdf29fd5f97f98f55e072e3 (diff)
parent53a487cd5019e7f7e3abee6b4a5e2d0b05aa34c6 (diff)
downloadotp-6c41e0910b2ccb12c7a431f4398a7d0213b5b02e.tar.gz
otp-6c41e0910b2ccb12c7a431f4398a7d0213b5b02e.tar.bz2
otp-6c41e0910b2ccb12c7a431f4398a7d0213b5b02e.zip
Merge branch 'lukas/erts/fix_init_stop_code_load_race/OTP-13802' into maint
* lukas/erts/fix_init_stop_code_load_race/OTP-13802: erts/kernel: Fix code loading deadlock during init:stop
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/code_server.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 1792f9e908..48541ec500 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -135,10 +135,14 @@ split_paths([], _S, Path, Paths) ->
-spec call(term()) -> term().
call(Req) ->
+ Ref = erlang:monitor(process, ?MODULE),
?MODULE ! {code_call, self(), Req},
receive
{?MODULE, Reply} ->
- Reply
+ erlang:demonitor(Ref,[flush]),
+ Reply;
+ {'DOWN',Ref,process,_,_} ->
+ exit({'DOWN',code_server,Req})
end.
reply(Pid, Res) ->