register、monitor的问题
erlang吧
全部回复
仅看楼主
level 9
囚徒君来 楼主
joe大神的新书里,有如下的描叙:
如果进程在on_exit被执行之前终止,就不会创建连接,on_exit进程的行为就会和预计的不同
如果有两个程序同时尝试用相同的Name值执行keep_alive,这个错误就会发生
这2句分开了,都能理解,但没想明白具体的执行流程,他说的是on_exit在monitor失败的情况下还是会收到DOWN消息吗?
还有如果注册了名字的进程挂了,不是应该对应的注册名也被取消了吗?
求大神指点,轻喷
2015年09月02日 03点09分 1
level 1
这样说,就是程序从挂了到被系统清理也有一个过程,如果监视了就会等它清理好了在重新建一个相同的进程,如果不监视,接到信号但在还没注销注册名之前就创建,这就有错误了。
2015年09月06日 03点09分 2
level 9
囚徒君来 楼主
谢谢鲱鱼的回答
还有个问题不明白:如果monitor一个已经挂掉的进程,也是接到DOWN信号吗?
monitor/2函数有如下描叙:
The monitor is triggered either when the monitored process terminates, is non existing, or if the connection to it is lost. In the case the connection to it is lost, we do not know if it still exist or not. After this type of monitor has been triggered, the monitor is automatically removed.
2015年09月07日 03点09分 3
1