[erlang-questions] Associating contextual info with monitors

Dave Rafkind <>
Tue Feb 19 19:54:39 CET 2008


Joern wrote:
> The state associated with the monitored processes was always in the
> domain of the monitoring behaviour (e.g. connections per ip address)
> however. Which meant that in many cases you actually wanted to have
> access to this information for other reasons than cleaning up. So
> either there needs to be a possibility to read the extra data from a
> monitor or you keep just another state term in your process.

On a somewhat related topic, I find myself wanting the following idiom:
- A gen_server that manages
- several processes (gen_servers, gen_fsm, or whatevs) where
- all are supervised by a supervisor

The gen_server manages all the state and brings up and shuts down the
other processes. So far it seems like I should start the supervisor with
just the manager under it, and then store the supervisor's Pid in the
manager, and then let the manger dynamically add and remove children
from the supervisor when appropriate.

However, this seems a bit awkward, the supervisor and the manager should
be combined in some way; is this possible? (can a module have 2
behaviours?) Or is there a better way to do it?



More information about the erlang-questions mailing list