Designing for Scalability with ErlangOTP by Francesco Cesarini

Designing for Scalability with ErlangOTP by Francesco Cesarini

Author:Francesco Cesarini
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2016-05-27T00:00:00+00:00


Basic template for starting a special process

The recommended approach to starting a special process is to use the proc_lib:start_link(Mod, Fun, Args) call instead of the spawn_link/3 BIF. Given a module, a function, and a list of arguments, it synchronously spawns a process and waits for this process to notify that it has correctly started through the proc_lib:init_ack(Value) call. Value is sent back to the parent process, becoming the return value of the start_link/3 call. Note how we are passing optional DbgOpts debug option parameters in our start_link call. We covered them in Chapter 5. For now, assume DbgOpts is an empty list. Note also how we are passing the Parent process ID to the init/3 function; we need it in our main loop. It is the result of the self() BIF in the start_link/2 call.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.