Merge pull request #5213 from tadeokondrak/evented-readv-fix

Fix std.event.Loop.readv
This commit is contained in:
Vexu 2020-04-30 11:00:27 +03:00 committed by GitHub
commit 611bd8e9f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1080,6 +1080,9 @@ pub const Loop = struct {
.read => |*msg| {
msg.result = noasync os.read(msg.fd, msg.buf);
},
.readv => |*msg| {
msg.result = noasync os.readv(msg.fd, msg.iov);
},
.write => |*msg| {
msg.result = noasync os.write(msg.fd, msg.bytes);
},
@ -1174,6 +1177,7 @@ pub const Loop = struct {
pub const Msg = union(enum) {
read: Read,
readv: ReadV,
write: Write,
writev: WriteV,
pwritev: PWriteV,
@ -1195,6 +1199,14 @@ pub const Loop = struct {
pub const Error = os.ReadError;
};
pub const ReadV = struct {
fd: os.fd_t,
iov: []const os.iovec,
result: Error!usize,
pub const Error = os.ReadError;
};
pub const Write = struct {
fd: os.fd_t,
bytes: []const u8,