simple_one_for_one worker

Bengt Kleberg bengt.kleberg@REDACTED
Fri Jul 1 08:21:36 CEST 2005


On 2005-07-01 05:48, tty@REDACTED wrote:
> Hello,
> 
> I have a simple_one_for_one supervisor. Its workers are meant to
> perform one task/transaction then terminate. How should this worker
> be defined ? Using gen_server seem to be the easiest but I'm confuse
> about terminating the worker.

terminating a gen_server is handled like this:

any one of the callback modules 3 handle_* functions (handle_call/3, 
handle_cast/2, handle_info/2) can return a tuple with the first member 
equal to stop (eg {stop,Reason,Reply,NewState} for handle_call/3).

The gen_server will then call Module:terminate(Reason,NewState) and 
terminate.

does this answer your question?


bengt



More information about the erlang-questions mailing list