Cloudef / zig-aio

io_uring like asynchronous API and coroutine powered IO tasks for zig
https://cloudef.github.io/zig-aio/
MIT License
175 stars 6 forks source link

Can't use aio.Timeout with coro.io.multi or complete #33

Closed MikeWey closed 2 weeks ago

MikeWey commented 2 weeks ago

Trying to use a Timeout with multi or complete leads to a compile error:

src/coro/io.zig:33:15: error: cannot store runtime value in compile time variable
            op.userdata = @intFromPtr(ctx);
            ~~^~~~~~~~~

This is with the latest zig-aio 2b91534 and zig: 0.14.0-dev.2218+862266514, the same error also occurs with zig 0.13.0 and the head of the zig-0.13 branch.

Managed to reduce it down to this, but was trying to combine the Timeout with Send.

const std = @import("std");
const aio = @import("aio");
const coro = @import("coro");

pub fn main() !void {
    try coro.io.multi(.{
        aio.Timeout{.ns = 1 * std.time.ns_per_s}
    });
}