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

libudev replacement #1

Open
Ravenslofty opened this issue Jun 2, 2019 · 2 comments
Open

libudev replacement #1

Ravenslofty opened this issue Jun 2, 2019 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed linux This issue affects Linux RIIR No native-Rust library exists thread-safety This issue affects thread safety

Comments

@Ravenslofty
Copy link
Member

Sharing a libudev context between threads is not safe (in rust terms a context is !Send), even when guarded by a mutex. This means that a USB context that depends on libudev must also be !Send. As a result, a Rust library needs to be created to talk to udev directly without using libudev.

@Ravenslofty Ravenslofty added enhancement New feature or request help wanted Extra attention is needed RIIR No native-Rust library exists thread-safety This issue affects thread safety linux This issue affects Linux labels Jun 2, 2019
This was referenced Jun 2, 2019
@Ravenslofty
Copy link
Member Author

So, having done some investigation, I think the safest approach is to make the whole library !Send and !Sync.

@kevinmehall
Copy link

Apparently the udev context isn't even necessary in modern versions of libudev: dcuddeback/libudev-rs#22

The documentation is outdated/unclear, but it indeed appears to not do anything: https://github.com/systemd/systemd/blob/24e4b4a199edd7fa743b39a36aa14d312fb94be5/src/libudev/libudev.c#L27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed linux This issue affects Linux RIIR No native-Rust library exists thread-safety This issue affects thread safety
Projects
None yet
Development

No branches or pull requests

2 participants