Jacob Young
753e71e2f5
std.Io.Threaded: implement and cleanup windows codepaths
2026-01-31 23:45:52 -08:00
Andrew Kelley
cc442d24ab
std.Io: move fileWriteStreaming to Operation
...
This serves as an example to contributors of how to move VTable
functions to becoming an Operation, thereby enabling Batch API and
timeouts.
2026-01-31 22:53:28 -08:00
Andrew Kelley
9bd648bd40
std.Io.Operation: support non-fallible results
2026-01-31 22:52:00 -08:00
Andrew Kelley
3abc96a601
std.Io: add test for batchAwaitAsync
...
and make it always work for all targets including WASI
This function guarantees no additional failure modes introduced.
2026-02-01 02:49:36 +01:00
kj4tmp@gmail.com
e60ba21114
libzigc: roundl
2026-02-01 00:59:35 +01:00
Andrew Kelley
2b19134c86
Merge pull request 'std.Io: introduce batching and operations API, satisfying the "poll" use case' ( #30743 ) from poll into master
...
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30743
2026-01-31 12:07:31 +01:00
Andrew Kelley
5ccc2ea85d
std: IoUring test handles EINTR
2026-01-31 09:36:40 +01:00
Andrew Kelley
9646801bed
std: fix Preopens compilation error
2026-01-30 22:06:33 -08:00
Andrew Kelley
14e1e5f6d8
std: IoUring test handles EINTR
2026-01-30 22:03:44 -08:00
Andrew Kelley
b6f4bb91c4
std.Io: add documentation to Batch
2026-01-30 22:03:33 -08:00
Andrew Kelley
25aef0dd87
std.Io.Threaded: rework file reading to observe nonblocking flag
...
- batchAwaitAsync does blocking reads with NtReadFile (no APC, no event)
when the nonblocking flag is unset, but still takes advantage of
APCs when nonblocking flag is set.
- batchAwaitConcurrent returns error.ConcurrencyUnavailable when it
encounters a file_read_streaming operation on a file in blocking mode.
- fileReadStreaming avoids pointlessly checking sync cancelation status
when nonblocking flag is set, uses an APC with a done flag, and waits
on that value to change in NtDelayExecution before returning.
- fix incorrect use of NtCancelIoFile (ntdll function prototype was
wrong, leading to misuse)
2026-01-30 22:03:14 -08:00
Andrew Kelley
39a6d5d1c5
std.Io.File: add non-blocking flag
...
On Windows, we need to know ahead of time whether a file was opened in
synchronous mode or asynchronous mode. There may be advantages to
tracking this state for POSIX operating systems as well.
2026-01-30 22:03:14 -08:00
Andrew Kelley
62c97b745d
std.Io.Threaded: stop checking bytes read with END_OF_FILE
2026-01-30 22:03:14 -08:00
Jacob Young
2674acdb77
Io.Batch: implement alternate API
2026-01-30 22:03:14 -08:00
Andrew Kelley
a520355e4c
std.process: simplify RunError set
2026-01-30 22:03:14 -08:00
Andrew Kelley
a41ee5994d
std.Build.Step: evalZigProcess handles EndOfStream
...
and a happy little info log when the process needs to be restarted
2026-01-30 22:03:14 -08:00
Andrew Kelley
866ee4f1c5
std.Io.Threaded: handle TIMEOUT from NtDelayExceution
2026-01-30 22:03:14 -08:00
Matthew Lugg
f8828e543a
std.Build: fully upgrade Step.Run to std.Io timing (and fix a typo)
2026-01-30 22:03:14 -08:00
Matthew Lugg
c2679feaaa
std.Io.Threaded: fix ntdll timeouts on Windows
2026-01-30 22:03:14 -08:00
Andrew Kelley
8f8aa8346a
std.Io.Threaded: ntReadFileResult handles EOF + bytes available
2026-01-30 22:03:14 -08:00
Andrew Kelley
4dd7fe90a2
std.Io.Threaded: compress ntReadFile logic
...
Just use the ntstatus field rather than an additional enum
2026-01-30 22:03:14 -08:00
Andrew Kelley
3320e6a1ae
std.Io.Threaded.batchWait better fix for any_done
...
It is legal to call batchWait with already completed operations in the
ring. In such case, we need to avoid waiting in the syscall. The
any_done flag was a poor way of tracking state we already have: whether
the completion queue is empty.
This problem affects the posix poll implementation as well.
Thanks again to jacobly for finding the problem.
2026-01-30 22:03:14 -08:00
Andrew Kelley
d770e14e00
std.Io.Threaded.batchWaitWindows: eager result sets any_done true
...
Thanks jacobly for finding the bug
2026-01-30 22:03:14 -08:00
Andrew Kelley
7a13d57916
std.Io.Threaded: add missing check for pending status in batchCancel
2026-01-30 22:03:14 -08:00
Andrew Kelley
687123a85e
std.process.run: use Io.File.MultiReader
...
and delete the special-cased function
2026-01-30 22:03:14 -08:00
Andrew Kelley
6a1fd3c69d
std.Io.File.MultiReader: make checkAnyError exclude EndOfStream
2026-01-30 22:03:14 -08:00
Andrew Kelley
8a80b54640
std: remove error.BrokenPipe from file reads, add error.EndOfStream
...
and make reading file streaming allowed to return 0 byte reads.
According to Microsoft documentation, on Windows it is possible to get
0-byte reads from pipes when 0-byte writes are made.
2026-01-30 22:03:14 -08:00
Andrew Kelley
fdf1ee973e
std.Io.Threaded: move the NtDelayExecution later in batchWait
...
also guard against receiving SUCCESS with 0 byte read
ms docs say that pipes can do this if there is a 0 byte write
2026-01-30 22:03:14 -08:00
Andrew Kelley
2fb224cb84
std.Io.Threaded: fix bad use of AlertableSyscall
...
The defer would cause two problems:
1. keeping the state active during call to NtCancelIoFile
2. invalid state transition. after canceled is returned from
checkCancel, new status is already canceled. calling finish after
that is illegal.
2026-01-30 22:03:14 -08:00
Andrew Kelley
efa502a1cd
std.Build.Step.Run: gracefully handle test runner misbehavior
...
specifically if it misbehaves after sending a message header but not the
body
2026-01-30 22:03:14 -08:00
Andrew Kelley
523aa213c9
std.Io.Threaded: batchWait and batchCancel for Windows
2026-01-30 22:03:14 -08:00
Andrew Kelley
37316a3cf6
std.Io.Threaded: resolve merge conflicts
2026-01-30 22:03:14 -08:00
Andrew Kelley
15ca46d1e7
std.Io.Threaded: fix compilation error on some systems
2026-01-30 22:03:14 -08:00
Andrew Kelley
a4d438562d
std.Io.Threaded: fix compilation failures on Windows
...
it's still broken as hell tho
2026-01-30 22:03:14 -08:00
Andrew Kelley
9134430387
std.Io.Threaded: fix batchWait impl
2026-01-30 22:03:14 -08:00
Andrew Kelley
68a34df025
std.Io.Threaded: fix error set
2026-01-30 22:03:14 -08:00
Andrew Kelley
372e8e54d3
compiler: update for std.Io.File.MultiReader API
2026-01-30 22:03:14 -08:00
Andrew Kelley
dd0153b91b
std.Io.operate: fix bogus catch
...
this used to have a different error set. just goes to show you how
useful switching on error set is even when there is only 1 prong
2026-01-30 22:03:14 -08:00
Andrew Kelley
e56563ce3f
std.Io.File.MultiReader: implementation fixes
2026-01-30 22:03:14 -08:00
Andrew Kelley
12cfc96e1b
std: update rest of build runner to new File.MultiReader API
2026-01-30 22:03:14 -08:00
Andrew Kelley
20cadd60aa
std.Io.File: introduce MultiReader
...
Concurrently read from multiple file streams, eliminating risk of
deadlocking.
2026-01-30 22:03:14 -08:00
Andrew Kelley
a0c2645948
std.Io.Threaded: delete dead code
2026-01-30 22:03:14 -08:00
Andrew Kelley
78a1476475
Build.WebServer: update concurrency API usage
2026-01-30 22:03:14 -08:00
Jacob Young
8146ccfecc
Io: add ring to Batch API
2026-01-30 22:03:14 -08:00
Andrew Kelley
0a379513af
std.Io.Threaded: super broken Windows impl of batch
...
this is a cry for help
2026-01-30 22:03:14 -08:00
Andrew Kelley
23d25dbb9e
std.process.Child.collectOutput: change back to other impl
...
this one avoids calling poll() more than necessary
2026-01-30 22:03:14 -08:00
Andrew Kelley
642f329ac9
std.Io: exploring a different batch API proposal
2026-01-30 22:03:14 -08:00
Andrew Kelley
e2a266e744
Revert "std.process.Child: rewrite using concurrent"
...
This reverts commit 76e1ba8f490812c6e2ebf6f6becd89a71275d21e.
2026-01-30 22:03:13 -08:00
Andrew Kelley
87408f8add
std.process.Child: rewrite using concurrent
...
I plan to immediately revert this, but here's a commit for posterity
2026-01-30 22:03:13 -08:00
Andrew Kelley
b996675dcf
fix error set
2026-01-30 22:03:13 -08:00