[erlang-questions] Terminating process after timeout

Ladislav Lenart lenartlad@REDACTED
Tue Jun 26 11:18:46 CEST 2007

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

More information about the erlang-questions mailing list