当进程死亡时,计时器ref是否被取消?

Bla*_*mba 3 erlang

我生成一个进程,并timer:apply_interval在生成的进程中运行,但计时器ref似乎无效.

这是代码:

2> {ok, File} = file:open("plcLog.txt", [append, raw]).
{ok,{file_descriptor,prim_file,{#Port<0.536>,10}}}
3>  spawn(fun() -> {ok, Tref} = timer:apply_interval(1, file, write, [File, "hello world"])
end).  
<0.37.0>
4> 
4> file:close(File).
ok
Run Code Online (Sandbox Code Playgroud)

当我检查内容时"plcLog.txt",它是空的.

所以我认为spwan进程死后定时器ref无效.这样对吗?

小智 5

Timer的文档提到通过评估任何函数创建的计时器apply_interval/4链接到计时器执行其任务的进程.注意定时器手册页的警告部分