我生成一个进程,并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无效.这样对吗?