[erlang-questions] How to properly declare a special process insupervisor's child specification?

Gunilla Arendt <>
Thu Jan 22 09:41:14 CET 2009


Hi,

As it says in the man page for supervisor, 'Modules' is used by the
release handler to determine which processes are using a certain module
during code replacement.

This means that if the value of 'Modules' is [foo,bar] the release
handler will suspend your special process and tell it to upgrade before
a new version of the foo or the bar module is loaded. And normally, you
would want to suspend/upgrade your process before loading a new version
of its callback module. So normally, 'Modules' would be a list
containing the name(s) of the callback module(s). You can read more
about this in OTP Design Principles, chapter 11.4.2 (Release
Handling/Release Handling Instructions/update).

If you don't use release handling/OTP code replacement the value of
'Modules' is not important as it is never used.

Best regards,
Gunilla


-----Original Message-----
From: 
[mailto:] On Behalf Of Sergey S
Sent: den 21 januari 2009 00:18
To: 
Subject: [erlang-questions] How to properly declare a special process
insupervisor's child specification?

Hello.

Saying "special process" I mean a process implemented using proc_lib/sys
facilities as illustrated in OTP Design Principles.

What should I use in "Modules" placeholder of child specification:

    child_spec() = {_, _, _, _, _, Modules}

[Module] or dynamic?

erl -man supervisor doesnt' give the answer:

-------------------8<-------------------
"As a rule of thumb Modules should be a list with one element [Module],
where Module is the callback module, if the child process is a >>>
supervisor, gen_server or gen_fsm <<<. If the child process is an >>>
event  manager  (gen_event) <<< with a dynamic set of callback modules,
Modules should be dynamic."
-------------------8<-------------------

But my process isn't supervisor, gen_server, gen_fsm nor gen_event.
But it's implemented to work like gen_server...

OTP Design Principles also says nothing about that (or at least I didn't
find anything making this clear)

I'm using "dynamic" now, but I'm not sure that it's right.

--
Sergey
_______________________________________________
erlang-questions mailing list

http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list