Skip to content

Conversation

@ryankurte
Copy link
Contributor

provides compatibility with smol::Async for polling from async contexts:

// Setup async device wrapper (configures device file descriptor with `O_NONBLOCK`)
let a = smol::Async::new(d)?;

// Async poll for the next event
let (_status, event) = a.read_with(|d| d.next_event(ReadFlag::NORMAL) ).await?;

for convenience Device also really needs to be Sync, which it is not automatically due to the internal *mut raw::libevdev, however, i can't see from the evdev docs whether this is reasonable or not?

provides compatibility with `smol::Async` for async use.
@ndesh26
Copy link
Owner

ndesh26 commented Nov 28, 2021

I haven't used Sync myself before so I need to look into it a bit more. Other things look good to me.

@ryankurte
Copy link
Contributor Author

having another look at this it appears y'all already have interior mutability with raw: *mut raw::libevdev so the borrow checker will allow multiple references which all can be (internally) mutated and adding Sync would let this occur across threads, which could expound any existing unsoundness.

i am however not sure how to mitigate this :-/

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