<div dir="ltr">I recall doing that about a year ago and having a lot of trouble supporting exits from the Erlang side and exits from the thread side.  Reviewing this code again today reveals that I was just confused about a few things and missed some easy fixes. :/  I guess the only thing callback pids could offer is higher messaging performance to NIF land by virtue of skipping the message copy to the proxy process and also the serialization imposed by the proxy process.  A high performance logger might find this useful.<div><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 29, 2015 at 1:49 PM Roger Lipscombe <<a href="mailto:roger@differentpla.net" target="_blank">roger@differentpla.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 29 September 2015 at 15:55, Daniel Goertzen<br>
<<a href="mailto:daniel.goertzen@gmail.com" target="_blank">daniel.goertzen@gmail.com</a>> wrote:<br>
> I love the Erlang NIF API, but one thing I’ve missed is a nice way to send<br>
> messages into NIF code.<br>
<br>
You can do this by simply having an Erlang process that calls the NIF<br>
when it receives a message:<br>
<br>
init(Args) -><br>
    This = my_nif:init(Args),<br>
    State = #state { this = This },<br>
    {ok, State}.<br>
<br>
handle_info(Info, #state { this = This } = State) -><br>
    my_nif:info(This, Info),<br>
    {noreply, State}.<br>
<br>
...etc.<br>
<br>
 It works pretty well for us. Is there any reason you don't want to do that?<br>
</blockquote></div></div></div>