-
Notifications
You must be signed in to change notification settings - Fork 83
Use mio to replace Epoll #316
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
base: main
Are you sure you want to change the base?
Conversation
cbb223d
to
138400e
Compare
2b19107
to
e53a34c
Compare
be19e30
to
158ca1d
Compare
44e7bb3
to
77ba627
Compare
vhost-user-backend/src/handler.rs
Outdated
let evt_idx = queues_mask.count_ones() - shifted_queues_mask.count_ones(); | ||
self.handlers[thread_index] | ||
.register_event(fd.as_raw_fd(), EventSet::IN, u64::from(evt_idx)) | ||
.register_event(fd.as_raw_fd(), EventSet::IN, evt_idx as usize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not to change now, but maybe we should change this type of casts to .try_into().map_err(...)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u32 to usize is safe? It is also safe to use the as
statement directly?
this LGTM |
When register_event we pass in the value of u32/u64, so we don't need to convert it to u16 and then pass it to handle_event. Signed-off-by: Wenyu Huang <[email protected]>
We can safely use usize instead of u64, because normally we will not register a data that exceeds the size of usize Signed-off-by: Wenyu Huang <[email protected]>
Epoll is linux-specific. So we use mio, which is a cross-platform event notification, to replace Epoll. Signed-off-by: Wenyu Huang <[email protected]>
Summary of the PR
Epoll is linux-specific. So we use mio, which is a cross-platform event notification, to replace Epoll.
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.