# std.Io: proof-of-concept "operations" API · gitcafe/zig

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

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

Visibility: public

Requested revision: 0a0ecc4fb132d086c0f816a304a9fd8fde4a803e

Requested commit: 0a0ecc4fb132d086c0f816a304a9fd8fde4a803e

Commit: 0a0ecc4fb132d086c0f816a304a9fd8fde4a803e

Tree: 64ad0e44de2b2ad1392874fd47aeeb154236ccda

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.Io: proof-of-concept "operations" API

This commit shows a proof-of-concept direction for std.Io.VTable to go,
which is to have general support for batching, timeouts, and
non-blocking.

I'm not sure if this is a good idea or not so I'm putting it up for
scrutiny.

This commit introduces `std.Io.operate`, `std.Io.Operation`, and
implements it experimentally for `FileReadStreaming`.

In `std.Io.Threaded`, the implementation is based on poll().

This commit shows how it can be used in `std.process.run` to collect
both stdout and stderr in a single-threaded program using
`std.Threaded.Io`.

It also demonstrates how to upgrade code that was previously using
`std.Io.poll` (*not* integrated with the interface!) using concurrency.
This may not be ideal since it makes the build runner no longer support
single-threaded mode. There is still a needed abstraction for
conveniently reading multiple File streams concurrently without
io.concurrent, but this commit demonstrates that such an API can be
built on top of the new `std.Io.operate` functionality.

```

## Parents

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

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