[erlang-questions] enif_send backpressure

Felix Gallo felixgallo@REDACTED
Thu May 25 19:07:48 CEST 2017

Rather than dive into the details of another process, wouldn't it be more
erlang to use enif_consume_timeslice (
http://erlang.org/doc/man/erl_nif.html#enif_consume_timeslice) and/or dirty
nifs and just let the scheduler do its thing?


On Thu, May 25, 2017 at 5:44 AM, Roger Lipscombe <roger@REDACTED>

> On 25 May 2017 at 13:20, Roger Lipscombe <roger@REDACTED> wrote:
>> 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.).
> I found the relevant code. Search for erts_use_sender_punish in the OTP
> source.
> Is there any way to implement something similar for enif_send from a NIF?
> 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?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170525/f43d6769/attachment.htm>

More information about the erlang-questions mailing list