Performing an orderly shutdown with OTP

Vance Shipley vances@REDACTED
Wed Jan 14 20:55:26 CET 2004


On Wed, Jan 14, 2004 at 09:55:49AM +0100, Ulf Wiger wrote:
}  
}  The supervisor behaviour terminates its children in the
}  reverse of the order in which they were started.
  
Which may not be the order I want them terminated.  Hmmm ...

And then it should follow that applications will be shutdown
in reverse order as well since they are all under one supervisor.

}  The start/2 callback allows the user to return a state,
}  which is then passed on to the stop/1 callback once the
}  processes of the application have been terminated.
}  The prep_stop/1 callback is called _before_ the processes
}  start terminating.

Ah yes.  So I can do my owm terminating here.  I'll save the 
Pids of my supervisors and in prep_stop/1 I can kill them off
in the order I require.  Perfect.

}  - prep_stop/1 is used in some occasions to close incoming
}    signaling ports before the processes start dying. This is
}    to reduce the noise when killing processes and removing
}    ets tables.
  
This is exactly the sort of thing I want to handle.  These are
processes which would have been started first but should be 
stopped first.  

Thanks,

	-Vance



More information about the erlang-questions mailing list