Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aio: add aio.Poll #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

aio: add aio.Poll #14

wants to merge 4 commits into from

Conversation

Nyaa97
Copy link

@Nyaa97 Nyaa97 commented Oct 7, 2024

src/aio/posix/posix.zig Outdated Show resolved Hide resolved
src/aio.zig Outdated Show resolved Hide resolved
src/aio/ops.zig Show resolved Hide resolved
src/aio/IoUring.zig Outdated Show resolved Hide resolved
@Nyaa97
Copy link
Author

Nyaa97 commented Oct 8, 2024

Poll events should be bit map
But I don't see myself using a single Pool for several events

pub const Poll = struct {
    pub const Events = packed struct(u32) {
        in: bool = false,
        out: bool = false,
        pri: bool = false,
        _: u29 = 0,
    };

    pub const Error = std.posix.PollError || SharedError;
    fd: std.posix.fd_t,
    events: Events = .{ .in = true },
    out_id: ?*Id = null,
    out_error: ?*Error = null,
    link: Link = .unlinked,
    userdata: usize = 0,
};


aio.Single(aio.Poll{ .fd = fd, .events = .{ .out = true } });

In addition, I don't like the implementation of Readiness.mode which makes it difficult to simply check mode

pub const Readiness = struct {
    fd: std.posix.fd_t = invalid_fd,
    mode: packed struct(i16) {
        in: bool = false,
        out: bool = false,
        pri: bool = false,
        kludge: bool = false,
        _: u12 = 0,
    },
};

I made a draft
I am not sure how it should be 🤔

@Cloudef
Copy link
Owner

Cloudef commented Oct 9, 2024

The readiness originally was not meant to implement poll. Your changes make sense. The kludge field probably can live outside of the packed struct as bool, as it is not a poll thing. Then I guess Events could be intCast'd to mode.

I'd also be grateful if you can add more tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants