Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
8086-Remove-intermediate-starter-process.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 8086-Remove-intermediate-starter-process.patch of Package erlang
From e5a56843c80845cb835a797b9802109ba0bdd77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muska=C5=82a?= <micmus@fb.com> Date: Tue, 23 Jan 2024 16:06:26 +0000 Subject: [PATCH 6/6] Remove intermediate starter process --- lib/kernel/src/application_controller.erl | 18 ++---------------- lib/kernel/src/application_master.erl | 15 ++++++++------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/lib/kernel/src/application_controller.erl b/lib/kernel/src/application_controller.erl index 2398f1dfc5..0363b7597a 100644 --- a/lib/kernel/src/application_controller.erl +++ b/lib/kernel/src/application_controller.erl @@ -36,7 +36,7 @@ %% Internal exports -export([handle_call/3, handle_cast/2, handle_info/2, terminate/2, - code_change/3, init_starter/2, get_loaded/1]). + code_change/3, get_loaded/1]). %% logger callback -export([format_log/1, format_log/2]). @@ -1391,27 +1391,13 @@ spawn_starter(Appl, S, Type) -> Reply = {info, {not_running, NotRunning}}, gen_server:cast(?AC, {application_started, Appl#appl.name, Reply}); false -> - spawn_link(?MODULE, init_starter, [Appl#appl.appl_data, Type]) + application_master:start_link(Appl#appl.appl_data, Type) end. -init_starter(ApplData, Type) -> - process_flag(trap_exit, true), - AppName = ApplData#appl_data.name, - gen_server:cast(?AC, {application_started, AppName, - catch start_appl(ApplData, Type)}). - reply(undefined, _Reply) -> ok; reply(From, Reply) -> gen_server:reply(From, Reply). -start_appl(ApplData, Type) -> - case application_master:start_link(ApplData, Type) of - {ok, _Pid} = Ok -> - Ok; - {error, _Reason} = Error -> - throw(Error) - end. - find_missing_dependency(Appl, Applications) -> Pred = fun(AppName) -> not lists:keymember(AppName, 1, Applications) end, lists:search(Pred, Appl#appl.apps -- Appl#appl.opt_apps). diff --git a/lib/kernel/src/application_master.erl b/lib/kernel/src/application_master.erl index fa8fed6d28..4daa9d453c 100644 --- a/lib/kernel/src/application_master.erl +++ b/lib/kernel/src/application_master.erl @@ -24,7 +24,7 @@ -export([get_child/1]). %% Internal exports --export([init/4, start_it/4]). +-export([init/3, start_it/4]). -include("application_master.hrl"). @@ -39,9 +39,8 @@ %% Returns: {ok, Pid} | {error, Reason} (Pid is unregistered) %%----------------------------------------------------------------- start_link(ApplData, Type) -> - Parent = whereis(application_controller), proc_lib:start_link(application_master, init, - [Parent, self(), ApplData, Type]). + [self(), ApplData, Type]). start_type() -> group_leader() ! {start_type, self()}, @@ -114,8 +113,9 @@ call(AppMaster, Req) -> %%%----------------------------------------------------------------- %%% Internal functions %%%----------------------------------------------------------------- -init(Parent, Starter, ApplData, Type) -> - link(Parent), +init(Parent, ApplData, Type) -> + %% Unblock the parent process as soon as possible + proc_lib:init_ack(Parent, {ok, self()}), process_flag(trap_exit, true), OldGleader = case group_leader() == whereis(init) of @@ -135,12 +135,13 @@ init(Parent, Starter, ApplData, Type) -> case start_it(State, Type) of {ok, Pid} -> % apply(M,F,A) returned ok ok = set_timer(ApplData#appl_data.maxT), - unlink(Starter), - proc_lib:init_ack(Starter, {ok,self()}), + gen_server:cast(Parent, {application_started, Name, {ok, self()}}), main_loop(Parent, State#state{child = Pid}); {error, Reason} -> % apply(M,F,A) returned error + gen_server:cast(Parent, {application_started, Name, {error, Reason}}), exit(Reason); Else -> % apply(M,F,A) returned erroneous + gen_server:cast(Parent, {application_started, Name, {error, Else}}), exit(Else) end. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor