<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I am pretty sure GEPD has zero-copy
      working for binaries the way you want it:<br>
      <a class="moz-txt-link-freetext" href="https://github.com/okeuday/GEPD/">https://github.com/okeuday/GEPD/</a><br>
      It would probably be similar to the pchar_test1.<br>
      <br>
      On 09/09/2014 09:49 AM, Steve Vinoski wrote:<br>
    </div>
    <blockquote
cite="mid:CAO+zUOU2ofN0J8XNpBWm73nFE+fVetPUoAXxeBfaxpS3m9oBqQ@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote">On Tue, Sep 9, 2014 at 12:40 PM, Max
            Lapshin <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</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">I need to send binary to
                  driver, do some  VERY cpu consumptive job with it
                  (transcoding video) and return back.</div>
                <div class="gmail_extra"><br>
                </div>
                <div class="gmail_extra"><br>
                </div>
                <div class="gmail_extra">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.</div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>I'm very interested in seeing an example of this.</div>
            <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 class="gmail_extra">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. <br>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>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.</div>
            <div><br>
            </div>
            <div>--steve</div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>