diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-05-02 14:08:59 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-05-02 14:09:17 -0400 |
| commit | 5656f5090d8646e076db50da03cfc6ae686eb76b (patch) | |
| tree | 89b400bd5cf8eadf57b92af194a44bc9530f9594 /lib/std/os.zig | |
| parent | 9dac8a5be9f5e439ea857b22867aaf2dc5b70c62 (diff) | |
| download | zig-5656f5090d8646e076db50da03cfc6ae686eb76b.tar.gz zig-5656f5090d8646e076db50da03cfc6ae686eb76b.zip | |
fs.File: improve handling async I/O on Windows
Before it was possible for .intended_io_mode = .blocking,
.capable_io_mode = .evented, and then the implementation would put a
request on the fs thread, which is the wrong behavior. Now it always
calls the appropriate WriteFile/ReadFile function, passing the intended
io mode directly as a parameter.
This makes the behavior tests pass on Windows with --test-evented-io.
Diffstat (limited to 'lib/std/os.zig')
| -rw-r--r-- | lib/std/os.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig index a1b0dc1991..d605c0eed3 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -365,7 +365,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { /// On these systems, the read races with concurrent writes to the same file descriptor. pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize { if (std.Target.current.os.tag == .windows) { - // TODO does Windows have a way to read an io vector? + // TODO improve this to use ReadFileScatter if (iov.len == 0) return @as(usize, 0); const first = iov[0]; return read(fd, first.iov_base[0..first.iov_len]); @@ -651,7 +651,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { /// If `iov.len` is larger than will fit in a `u31`, a partial write will occur. pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { if (std.Target.current.os.tag == .windows) { - // TODO does Windows have a way to write an io vector? + // TODO improve this to use WriteFileScatter if (iov.len == 0) return @as(usize, 0); const first = iov[0]; return write(fd, first.iov_base[0..first.iov_len]); |
