-
Notifications
You must be signed in to change notification settings - Fork 208
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
refact: use mio for daemon exit signal monitoring #340
Conversation
bfd36ba
to
a0f7dd9
Compare
Linux |
|
}; | ||
use std::thread; | ||
use std::thread::{self, spawn}; | ||
use std::{io, process}; | ||
|
||
use clap::{App, Arg}; | ||
use event_manager::{EventManager, EventSubscriber, SubscriberOps}; |
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.
Are these still needed after switch to mio?
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.
"spawn" is still needed for starting monitor so far(line 496).
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.
The http thread is still using eventfd to exit itself. Are you planning to switch it (via the new micro_http crate) in a different PR?
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.
The http thread is still using eventfd to exit itself. Are you planning to switch it (via the new micro_http crate) in a different PR?
Yes. In a later PR.
}; | ||
use std::thread; | ||
use std::thread::{self, spawn}; | ||
use std::{io, process}; | ||
|
||
use clap::{App, Arg}; | ||
use event_manager::{EventManager, EventSubscriber, SubscriberOps}; |
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.
The http thread is still using eventfd to exit itself. Are you planning to switch it (via the new micro_http crate) in a different PR?
@@ -91,12 +92,12 @@ fn get_default_rlimit_nofile() -> Result<rlim> { | |||
} | |||
|
|||
pub fn exit_event_manager() { |
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.
We'd better use as few global variables/functions as possible, how about wrapping an exit manager as a struct implementation, and putting it to FuseDaemon/VirtiofsDaemon? (This is not a blocker for this PR at all)
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.
We'd better use as few global variables/functions as possible, how about wrapping an exit manager as a struct implementation, and putting it to FuseDaemon/VirtiofsDaemon? (This is not a blocker for this PR at all)
Absolutely right. Event manager maybe removed, together with global shared memory - EXIT_MANAGER_RUN in later PR.
LGTM! Please fold the two commits into a single one. |
Signed-off-by: 泰友 <[email protected]> fix: chore Signed-off-by: 泰友 <[email protected]>
Nydusd responds to SYS_TERM and SYS_INT based on event poll. In fact, it needs a way to communicate between threads. Event poll is platform-coherent.
This PR replace raw eventfd with MIO, which is a I/O library for focusing on non-blocking APIs.