[erlang-questions] Stopping gen_server during processing

Bengt Kleberg bengt.kleberg@REDACTED
Fri Nov 8 09:27:55 CET 2013


These are my opinions, not hard facts.

Add a member to the gen_server state record that says that you are going
to stop when possible. Use a cast to set it to true when you want to
stop. If it is true and you can stop the gen_server, stop it.


bengt

On Fri, 2013-11-08 at 08:55 +0100, Janos Hary wrote:
> All,
> 
>  
> 
> I have a gen_server process which periodically processes new records
> from a database. I use timer:send_after to schedule gathering and
> processing new records. I can gracefully stop the gen_server when it
> is waiting, but I need a way to stop it during processing. Of cause I
> only want to stop it at certain points of the processing, for example
> before starting to process the next record. I need to group the
> records, so I cannot ask them one by one from the db.
> 
>  
> 
> What is the preferred way of doing this?
> 
>  
> 
> Thanks for your answers in advance.
> 
> Janos  
> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list