[erlang-questions] Process scope variable

Imants Cekusins imantc@REDACTED
Thu Feb 19 13:51:58 CET 2015


ok, found the solution:

store complete state in a separate linked gs.

when an fsm A starts, it start_links a gs B whose sole responsibility
is store & update A's state content. A does not really store anything
apart from B's pid. maybe a ref, too - to filter out unintended calls.

this "state" gs B can be called from any process (A or any spawned
one) to  store or update A's state.

so the only piece of state we need to pass around is the gs B Pid.
"simple'z" :)

remember to stop the "state" gs when the parent fsm terminates.


how about that?



More information about the erlang-questions mailing list