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

Add AsyncFd::with_interest #3167

Merged
merged 3 commits into from
Nov 30, 2020

Conversation

HK416-is-all-you-need
Copy link
Contributor

Expose Interest customization for AsyncFd

Fixes #3072

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I opened a minor naming point.

pub(crate) fn new_with_handle(inner: T, handle: Handle) -> io::Result<Self> {
/// Creates new instance as `new` with additional ability to customize interest,
/// allowing to specify whether file descriptor will be polled for read, write or both.
pub fn new_with_interest(inner: T, interest: Interest) -> io::Result<Self>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'm wondering if this should just be with_interest (modeling after Vec::with_capacity).

The other new_with fns are internal and haven't received as much attention naming wise.

Thoughts @tokio-rs/maintainers ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have a slight preference for with_interest, but i could be convinced otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to with_interest, it is shorter too so I would prefer it

@Darksonn Darksonn added A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-io Module: tokio/io labels Nov 28, 2020
}

pub(crate) fn new_with_handle(inner: T, handle: Handle) -> io::Result<Self> {
pub(crate) fn new_with_handle_and_interest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may also want to rename this to with_handle_and_interest for consistency, but definitely not a blocker. I will merge this shortly if nobody has any other comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-io Module: tokio/io
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AsyncFd doesn't allow to decide read/write interest making kqueue's fd fail in tokio 0.3
4 participants