[erlang-questions] "sendfile" call as NIF. Good or bad idea?
Tue Nov 30 17:38:22 CET 2010
Michale Santos pointed me that there's some work (by Björn Gustavsson)
to integrate "sendfile" natively
Could someone from OTP team tell me if this will happen soon? In which
release if possible?
2010/11/27 zabrane Mikael <zabrane3@REDACTED>:
> Hi Steve,
>> Not sure why you find it cryptic, since as drivers go it's pretty
>> simple. Can you provide further details?
> Maybe it was because NIF are very simple to read/write.
> Again, no offense ... forget about that comment.
>> The benefit of a driver is that we can just register each socket FD
>> with erts and it lets us know when each socket is writeable. The
>> driver mainly just handles tracking how much was written by each
>> sendfile call, incrementing offsets, etc.
> Thanks for this. I didn't consider this problem at all.
>> If you implemented it as a NIF, you'd need to perform your own polling
>> on the socket FDs to know when sendfile can write to them. This alone
>> might mean a portability issue, since you'd have to know to use the
>> right polling mechanism for the given platform. You'd also need to do
>> all this in your own thread, whereas the driver doesn't have to deal
>> with threads.
> So, I'll stick with your driver.
> Thanks Steve.
More information about the erlang-questions