enif_send, terms and msg_env

Sverker Eriksson sverker.eriksson@REDACTED
Thu Sep 17 10:28:57 CEST 2020


>> The message environment msg_env with all its terms (including msg) is 
>> invalidated by a successful call to enif_send.
>
> I have created msg in another environment and I do not want to invalidate 
> it.
>
> Should I just prefer using NULL for msg_env in this case?
>

Yes. With msg_env==NULL the message will be copied to the receiver. With 
msg_env!=NULL the message will be handed over to the receiver together will 
any other terms in msg_env which will become garbage.


/Sverker Erlang/OTP


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5509 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200917/86889413/attachment.bin>


More information about the erlang-questions mailing list