[erlang-questions] what is spawn_request/1 ?

Adel Zhang adelzhang@REDACTED
Fri Sep 19 06:21:26 CEST 2014


hi,

I find the following comments in application_master.erl:

	%%%-----------------------------------------------------------------
	%%% The logical and physical process structrure is as follows:
	%%%
	%%%         logical                physical
	%%%
	%%%         --------               --------
	%%%         |AM(GL)|               |AM(GL)|
	%%%         --------               --------
	%%%            |                       |
	%%%         --------               --------
	%%%         |Appl P|               |   X  |
	%%%         --------               --------
	%%%                                    |
	%%%                                --------
	%%%                                |Appl P|
	%%%                                --------
	%%%
	%%% Where AM(GL) == Application Master (Group Leader)
	%%%       Appl P == The application specific root process (child to AM)
	%%%       X      == A special 'invisible' process
	%%% The reason for not using the logical structrure is that
	%%% the application start function is synchronous, and
	%%% that the AM is GL.  This means that if AM executed the start
	%%% function, and this function uses spawn_request/1
	%%% or io, deadlock would occur.  Therefore, this function is
	%%% executed by the process X.  Also, AM needs three loops;
	%%% init_loop (waiting for the start function to return)
	%%% main_loop
	%%% terminate_loop (waiting for the process to die)
	%%% In each of these loops, io and other requests are handled.

It mentions that if GL uses *spawn_request/1*, deadlock would occur. What  
is spawn_request/1? Cannot find
the function in Erlang/OTP library.





More information about the erlang-questions mailing list