aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/application_master.erl
diff options
context:
space:
mode:
authorXavier Noria <[email protected]>2018-04-05 01:40:20 +0200
committerXavier Noria <[email protected]>2018-06-13 12:04:08 +0200
commitb0900fc2f7daab1c77dd8878c39ab24591bb076b (patch)
treea7f75ae939076a1e54213b3db883fd3478097548 /lib/kernel/src/application_master.erl
parente754f23ead59f8592f3a1cbb66e22cfdba73517d (diff)
downloadotp-b0900fc2f7daab1c77dd8878c39ab24591bb076b.tar.gz
otp-b0900fc2f7daab1c77dd8878c39ab24591bb076b.tar.bz2
otp-b0900fc2f7daab1c77dd8878c39ab24591bb076b.zip
Explain why the AM becomes group leader
Diffstat (limited to 'lib/kernel/src/application_master.erl')
-rw-r--r--lib/kernel/src/application_master.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/kernel/src/application_master.erl b/lib/kernel/src/application_master.erl
index 5da2b0b06c..06991b45e1 100644
--- a/lib/kernel/src/application_master.erl
+++ b/lib/kernel/src/application_master.erl
@@ -118,6 +118,10 @@ init(Parent, Starter, ApplData, Type) ->
link(Parent),
process_flag(trap_exit, true),
OldGleader = group_leader(),
+ %% We become the group leader, but forward all I/O to OldGleader.
+ %% This is just a way to identify processes that belong to the
+ %% application. Used for example to find ourselves from any
+ %% process, or, reciprocally, to kill them all when we terminate.
group_leader(self(), self()),
%% Insert ourselves as master for the process. This ensures that
%% the processes in the application can use get_env/1 at startup.