# std.Io.Threaded: rework file reading to observe nonblocking flag · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/25aef0dd8786c5b5342eda167a609529efa09353)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 25aef0dd8786c5b5342eda167a609529efa09353

Requested commit: 25aef0dd8786c5b5342eda167a609529efa09353

Commit: 25aef0dd8786c5b5342eda167a609529efa09353

Tree: e2d2c7fbb1f22b62533647a3976acf2bde8b30df

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
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)

```

## Parents

- [39a6d5d1c5db32e9648fba6a46f3fef4ef83974a](https://git.cafe/gitcafe/zig/commit/39a6d5d1c5db32e9648fba6a46f3fef4ef83974a?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/25aef0dd8786c5b5342eda167a609529efa09353?format=markdown)
