Erlang 消息到不存在的 PID
Erlang message to non-existent PID
Erlang 运行时如何处理发送到不存在的进程的消息?例如,生成一个进程,然后在它终止后另一个进程向它发送消息。
邮件已删除。每 the documentation:
If the receiver has terminated, the signal will not arrive...
另请参阅this answer from rvirding,谁可能知道他在说什么:
While sending a message to a pid which refers to a dead process is perfectly legal (the message just disappears)...
如果消息被发送到一个PID,那么消息将消失于虚空。您甚至可以发送到不存在的 PID...
1> list_to_pid("<0.0.1>").
<0.0.1>
2> v(1) ! foo.
foo
如果消息发送给原子,原子必须是发送时注册的PID名称,否则发送会崩溃...
3> spawn(fun() -> register(name, self()), then_exit end).
<0.36.0>
4> name ! foo.
** exception error: bad argument
in operator !/2
called as name ! foo
Erlang 运行时如何处理发送到不存在的进程的消息?例如,生成一个进程,然后在它终止后另一个进程向它发送消息。
邮件已删除。每 the documentation:
If the receiver has terminated, the signal will not arrive...
另请参阅this answer from rvirding,谁可能知道他在说什么:
While sending a message to a pid which refers to a dead process is perfectly legal (the message just disappears)...
如果消息被发送到一个PID,那么消息将消失于虚空。您甚至可以发送到不存在的 PID...
1> list_to_pid("<0.0.1>").
<0.0.1>
2> v(1) ! foo.
foo
如果消息发送给原子,原子必须是发送时注册的PID名称,否则发送会崩溃...
3> spawn(fun() -> register(name, self()), then_exit end).
<0.36.0>
4> name ! foo.
** exception error: bad argument
in operator !/2
called as name ! foo