[erlang-questions] Terminating process after timeout
Tue Jun 26 11:31:46 CEST 2007
Wow I've forgot to check timer module, thanks Ladislav!
Using timer:send_after would require for the spawned process to listen
to the messages in receive loop, or it will require additinal process
I think it could be done easier using timer:kill_after/2
On 6/26/07, Ladislav Lenart <> wrote:
Kirill Zaborski wrote:
> > I was wondering - what is the right way to to spawn a process and kill
> > it if it runs more than some threshold? The only way I see at the
> > moment is to spawn process aditional process which will check if the
> > worker procees finished after the specified time and if not it will
> > kill the worker.
> > Is there some other ways to implement the desired behaviour?
> The process can alternatively plan a timer event via timer:send_after/2,3
> for example in its init to send itself a (deferred) message to terminate...
> Hope this helps,
> Ladislav Lenart
> erlang-questions mailing list
More information about the erlang-questions