I know that monitoring a "process" on a C Node is not supported, but if I try to call link for a pid originating from a C Node on an Erlang node, my C Node first gets an ERL_LINK
message and then few moments later an ERL_EXIT
message since obviously the linked Erlang process crashed.
Probably since my C Node did not respond to the ERL_LINK
and Erlang determined that my C Node "process" has died.
I would like to know if this is supported at all? And how does the C Node need to handle the ERL_LINK
message in order to make this work.
The good news:
It is actually pretty simple. It seems that I made a mistake when thinking that the linked Erlang process died since my C node did not process the ERL_LINK message.
The C node does not have to do anything if Erlang node links to a "pid" originating from it. Once link is called, C node will get an ERL_LINK message with from/to filled out with appropriate pids. If Erlang process dies it will get an ERL_EXIT message. Its contents will be whatever Erlang terms are specified as the Reason for EXIT message. If the C node dies/looses connection then the linked Erlang process will get an appropriate EXIT message.
The bad news:
There is no support in erl_interface for the C node to send ERL_EXIT or ERL_LINK back to Erlang. Seems that it was considered at some point but the code is left in a folder called "not_used"