[erlang-questions] enif_send backpressure
Thu May 25 21:11:52 CEST 2017
On 25 May 2017 at 18:07, Felix Gallo <felixgallo@REDACTED> wrote:
> 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?
This stuff's running on a background thread. Specifically, it's running a
Squirrel VM (squirrel-lang.org) on a background thread. Some of the calls
in the squirrel code result in enif_send to the accompanying (1:1) Erlang
process. I'd like the squirrel to (briefly) pause if the Erlang process
has too many messages in its queue.
 not actually pause; we're running 10s of thousands of these on a pool
of background threads, we want the one that's calling enif_send too
frequently to yield, *exactly* the same as an Erlang process would do.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions