| ... | ... | @@ -113,6 +113,8 @@ pub async fn pwriteWindows(loop: *Loop, fd: os.FileHandle, data: []const u8, off |
| 113 | 113 | }, |
| 114 | 114 | }; |
| 115 | 115 | const completion_key = @ptrToInt(&resume_node.base); |
| 116 | // TODO support concurrent async ops on the file handle |
| 117 | // we can do this by ignoring completion key and using @fieldParentPtr with the *Overlapped |
| 116 | 118 | _ = try os.windowsCreateIoCompletionPort(fd, loop.os_data.io_port, completion_key, undefined); |
| 117 | 119 | var overlapped = windows.OVERLAPPED{ |
| 118 | 120 | .Internal = 0, |
| ... | ... | @@ -247,6 +249,8 @@ pub async fn preadWindows(loop: *Loop, fd: os.FileHandle, data: []u8, offset: u6 |
| 247 | 249 | }, |
| 248 | 250 | }; |
| 249 | 251 | const completion_key = @ptrToInt(&resume_node.base); |
| 252 | // TODO support concurrent async ops on the file handle |
| 253 | // we can do this by ignoring completion key and using @fieldParentPtr with the *Overlapped |
| 250 | 254 | _ = try os.windowsCreateIoCompletionPort(fd, loop.os_data.io_port, completion_key, undefined); |
| 251 | 255 | var overlapped = windows.OVERLAPPED{ |
| 252 | 256 | .Internal = 0, |
| ... | ... | @@ -831,8 +835,7 @@ pub fn Watch(comptime V: type) type { |
| 831 | 835 | var it = self.os_data.dir_table.iterator(); |
| 832 | 836 | while (it.next()) |entry| { |
| 833 | 837 | allocator.free(entry.key); |
| 834 | | // TODO why does freeing this memory crash the test? |
| 835 | | //allocator.destroy(entry.value); |
| 838 | allocator.destroy(entry.value); |
| 836 | 839 | } |
| 837 | 840 | self.os_data.dir_table.deinit(); |
| 838 | 841 | self.channel.destroy(); |
| ... | ... | @@ -1100,13 +1103,15 @@ pub fn Watch(comptime V: type) type { |
| 1100 | 1103 | }; |
| 1101 | 1104 | var event_buf: [4096]u8 align(@alignOf(windows.FILE_NOTIFY_INFORMATION)) = undefined; |
| 1102 | 1105 | |
| 1106 | // TODO handle this error not in the channel but in the setup |
| 1107 | _ = os.windowsCreateIoCompletionPort( |
| 1108 | dir_handle, self.channel.loop.os_data.io_port, completion_key, undefined, |
| 1109 | ) catch |err| { |
| 1110 | await (async self.channel.put(err) catch unreachable); |
| 1111 | return; |
| 1112 | }; |
| 1113 | |
| 1103 | 1114 | while (true) { |
| 1104 | | _ = os.windowsCreateIoCompletionPort( |
| 1105 | | dir_handle, self.channel.loop.os_data.io_port, completion_key, undefined, |
| 1106 | | ) catch |err| { |
| 1107 | | await (async self.channel.put(err) catch unreachable); |
| 1108 | | return; |
| 1109 | | }; |
| 1110 | 1115 | { |
| 1111 | 1116 | // TODO only 1 beginOneEvent for the whole coroutine |
| 1112 | 1117 | self.channel.loop.beginOneEvent(); |
| ... | ... | @@ -1343,7 +1348,6 @@ async fn testFsWatch(loop: *Loop) !void { |
| 1343 | 1348 | WatchEventId.CloseWrite => {}, |
| 1344 | 1349 | WatchEventId.Delete => @panic("wrong event"), |
| 1345 | 1350 | } |
| 1346 | | |
| 1347 | 1351 | const contents_updated = try await try async readFile(loop, file_path, 1024 * 1024); |
| 1348 | 1352 | assert(mem.eql(u8, contents_updated, |
| 1349 | 1353 | \\line 1 |