Supervisor shutdown

HEINRICH VENTER HEINRICH.VENTER@REDACTED
Tue Nov 25 12:09:46 CET 2003


>     -the gen_server has been set to trap exit signals, and
I seem to have missed this bit.  Now that it traps the exit signals with 

process_flag(trap_exit, true)

Everything works out smoothely, or rather more smoothely.

I have a spanner to throw in the works now however :)

The gen_sever spawns some worker processes that need to be termianted.  These processes might not terminate immediately when the stop message is sent to them. (I have discovered a falw in the curent design but will post to a separate thread about this)  The gen_server can not terminate before all its workers have terminated in an orderly fasion, BUT since the stop function executes in a handle_call and the workers notify the gen_server of their termination through a different handle_call.
This brings me to the {noreply, State} mentioned in another thread.
How do I know the PID where to send the response at the later time when I am ready to quit?  The process dictionary perhaps? Then use the function that notifies the gen_server of the process termination to check if all the processes are down and then reply with the {stop, normal, ok, State} message instead of {reply, State}
Does this make sense?

-]-[einrich

#####################################################################################
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material.  Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from any system and destroy all copies.
#####################################################################################



More information about the erlang-questions mailing list