Fix std.event.Loop.readv

master
Tadeo Kondrak 2020-04-29 04:33:05 -06:00
parent 5929e5ca0e
commit 07c1be80c2
No known key found for this signature in database
GPG Key ID: D41E092CA43F1D8B
1 changed files with 12 additions and 0 deletions

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,