[erlang-questions] erl_driver: is char *buf from control safe?

Steve Vinoski vinoski@REDACTED
Tue Sep 9 18:49:04 CEST 2014


On Tue, Sep 9, 2014 at 12:40 PM, Max Lapshin <max.lapshin@REDACTED> wrote:

> I need to send binary to driver, do some  VERY cpu consumptive job with it
> (transcoding video) and return back.
>
>
> I was trying to use dirty NIFs, but it seems to be very unstable: after
> several hours of work whole erlang machine becomes very, very slowly
> without any CPU usage.
>

I'm very interested in seeing an example of this.

Now I try to migrate to erl drivers, but I've got new problem: I don't
> understand how to get zerocopy from erlang level to C level.
>

Pass your data to the driver via port_command, as Lukas suggested.
Implement the outputv callback and call driver_enqv to enqueue the incoming
ErlIOVec argument into your driver queue. This won't copy. Also, since
async threads are involved for doing the work, use the port data lock to
protect the queue, as Lukas suggested.

--steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140909/5c5f866e/attachment.htm>


More information about the erlang-questions mailing list