[erlang-questions] "sendfile" call as NIF. Good or bad idea?

zabrane Mikael zabrane3@REDACTED
Sat Nov 27 20:06:43 CET 2010


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.

-- 
Regards
Zabrane


More information about the erlang-questions mailing list