| ... | @@ -1022,7 +1022,7 @@ pub const Loop = struct { | ... | @@ -1022,7 +1022,7 @@ pub const Loop = struct { |
| 1022 | | 1022 | |
| 1023 | /// Performs an async `os.pwrite` using a separate thread. | 1023 | /// Performs an async `os.pwrite` using a separate thread. |
| 1024 | /// `fd` must block and not return EAGAIN. | 1024 | /// `fd` must block and not return EAGAIN. |
| 1025 | pub fn pwrite(self: *Loop, fd: os.fd_t, bytes: []const u8, offset: u64, simulate_evented: bool) os.PWriteError!usize { | 1025 | pub fn pwrite(self: *Loop, fd: os.fd_t, bytes: []const u8, offset: u64, simulate_evented: bool) os.PerformsWriteError!usize { |
| 1026 | if (simulate_evented) { | 1026 | if (simulate_evented) { |
| 1027 | var req_node = Request.Node{ | 1027 | var req_node = Request.Node{ |
| 1028 | .data = .{ | 1028 | .data = .{ |
| ... | @@ -1056,24 +1056,36 @@ pub const Loop = struct { | ... | @@ -1056,24 +1056,36 @@ pub const Loop = struct { |
| 1056 | | 1056 | |
| 1057 | /// Performs an async `os.pwritev` using a separate thread. | 1057 | /// Performs an async `os.pwritev` using a separate thread. |
| 1058 | /// `fd` must block and not return EAGAIN. | 1058 | /// `fd` must block and not return EAGAIN. |
| 1059 | pub fn pwritev(self: *Loop, fd: os.fd_t, iov: []const os.iovec_const, offset: u64) os.PWriteError!usize { | 1059 | pub fn pwritev(self: *Loop, fd: os.fd_t, iov: []const os.iovec_const, offset: u64, simulate_evented: bool) os.PWriteError!usize { |
| 1060 | var req_node = Request.Node{ | 1060 | if (simulate_evented) { |
| 1061 | .data = .{ | 1061 | var req_node = Request.Node{ |
| 1062 | .msg = .{ | 1062 | .data = .{ |
| 1063 | .pwritev = .{ | 1063 | .msg = .{ |
| 1064 | .fd = fd, | 1064 | .pwritev = .{ |
| 1065 | .iov = iov, | 1065 | .fd = fd, |
| 1066 | .offset = offset, | 1066 | .iov = iov, |
| 1067 | .result = undefined, | 1067 | .offset = offset, |
| | 1068 | .result = undefined, |
| | 1069 | }, |
| 1068 | }, | 1070 | }, |
| | 1071 | .finish = .{ .TickNode = .{ .data = @frame() } }, |
| 1069 | }, | 1072 | }, |
| 1070 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1073 | }; |
| 1071 | }, | 1074 | suspend { |
| 1072 | }; | 1075 | self.posixFsRequest(&req_node); |
| 1073 | suspend { | 1076 | } |
| 1074 | self.posixFsRequest(&req_node); | 1077 | return req_node.data.msg.pwritev.result; |
| | 1078 | } else { |
| | 1079 | while (true) { |
| | 1080 | return os.pwritev(fd, iov, offset) catch |err| switch (err) { |
| | 1081 | error.WouldBlock => { |
| | 1082 | self.waitUntilFdWritable(fd); |
| | 1083 | continue; |
| | 1084 | }, |
| | 1085 | else => return err, |
| | 1086 | }; |
| | 1087 | } |
| 1075 | } | 1088 | } |
| 1076 | return req_node.data.msg.pwritev.result; | | |
| 1077 | } | 1089 | } |
| 1078 | | 1090 | |
| 1079 | /// Performs an async `os.faccessatZ` using a separate thread. | 1091 | /// Performs an async `os.faccessatZ` using a separate thread. |