public void SendFile(int out_fd, int in_fd, long offset, long length, Action <long, int> callback) { Libeio.sendfile(out_fd, in_fd, offset, length, (arg1, arg2) => { outstanding.Enqueue(() => callback(arg1, arg2)); pulse.Send(); }); }
void SendNextBlock() { Libeio.sendfile(target.Handle.ToInt32(), sourceFd, position, length - position, (len, err) => { if (len >= 0) { position += len; } else { completed = true; } if (position == length) { completed = true; } target.ResumeWriting(); }); }