<div dir="ltr">Rather than dive into the details of another process, wouldn't it be more erlang to use enif_consume_timeslice (<a href="http://erlang.org/doc/man/erl_nif.html#enif_consume_timeslice">http://erlang.org/doc/man/erl_nif.html#enif_consume_timeslice</a>) and/or dirty nifs and just let the scheduler do its thing?<div><br></div><div>F.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 25, 2017 at 5:44 AM, Roger Lipscombe <span dir="ltr"><<a href="mailto:roger@differentpla.net" target="_blank">roger@differentpla.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On 25 May 2017 at 13:20, Roger Lipscombe <span dir="ltr"><<a href="mailto:roger@differentpla.net" target="_blank">roger@differentpla.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It's my understanding that if a normal Erlang process does Pid ! Msg, and Pid has a particularly full message queue, then the sending process is penalised (gives up the remainder of its timeslice, e.g.).</div></blockquote><div><br></div></span><div>I found the relevant code. Search for erts_use_sender_punish in the OTP source.</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Is there any way to implement something similar for enif_send from a NIF?</div></div></blockquote><div><br></div></span><div>Note that enif_send calls erts_queue_message, which *does* return the recipient's queue length (afaict). It's just that enif_send discards the result. Would a PR which implemented (e.g.) enif_send_return_len -- naming is hard, suggestions appreciated -- be considered for OTP 20.x?</div><div><br></div></div></div></div>
<br>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>