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

simple mio example #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lthiery
Copy link

@lthiery lthiery commented Aug 11, 2018

I was trying to use this library without all the tokio stuff and wished there was a mio example. I shared back this example, although it's not fancy and doesn't take args.

Plus, there is something funny happening where the first event is non-sense...

@posborne
Copy link
Member

Thanks for the example @lthiery; can you run rustfmt on this? I'll give it a once-over as well in more detail.

examples/mio.rs Outdated

// TODO: for some reason, there is always a dummy event initially
// Workaround: waste the first event
poll.poll(&mut events, None).unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

This is expected behavior from the linux kernel.

Copy link
Author

Choose a reason for hiding this comment

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

Interesting! I had no idea. Is there a TLDR of why it's expected so I can add it to the comments?

examples/mio.rs Outdated
fn main(){

let pin = Pin::new(49);
pin.set_direction(Direction::In).unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

Rather than doing unwrap everywhere it might be best to create a helper that returns the appropriate result.

@mathk
Copy link

mathk commented Feb 22, 2019

bors try

@mathk mathk added S-waiting-on-review S-waiting-on-author Status: Author needs to make changes labels Feb 22, 2019
@posborne
Copy link
Member

@mathk I haven't made my rounds on this repo to enable bors yet but may be doing some of that tomorrow.

@posborne
Copy link
Member

This probably needs a rebase to have a better chance with CI.

@mathk
Copy link

mathk commented Feb 25, 2019

I guess you need to feature gate your test:
#[cfg(feature = "mio-evented")]

@eldruin
Copy link
Member

eldruin commented Sep 24, 2021

This would need to be adapted to the updated mio version now.
bors try

bors bot added a commit that referenced this pull request Sep 24, 2021
@bors
Copy link
Contributor

bors bot commented Sep 24, 2021

try

Build failed:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: Author needs to make changes S-waiting-on-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants