-
Notifications
You must be signed in to change notification settings - Fork 353
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
Try to ensure measureme output is valid when the interpreter is interrupted #2899
Conversation
src/concurrency/thread.rs
Outdated
// immediately. In our interpreter loop we try to consult this value often, but if for | ||
// whatever reason we don't get to that check or the cleanup we do upon finding that | ||
// this bool has become true takes a long time, the exit here will promptly exit the | ||
// process. |
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.
// process. | |
// process on the 2nd Ctrl-C. |
That's assuming I understood the code correctly
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.
Yup.
|
||
/// Called when the interpreter is going to shut down abnormally, such as due to a ctrl+c. | ||
pub(crate) fn handle_abnormal_termination(&mut self) { | ||
drop(self.profiler.take()); |
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.
Would be good to have a comment explaining why this is important.
r=me after squashing |
76acfcc
to
e0080bf
Compare
@bors r=RalfJung |
☀️ Test successful - checks-actions |
Dropping our
measureme::Profiler
will have the profiler flush its output buffer and write out its string table. If the profiler'sDrop
impl does not run, the output file is not usable.This approach has zero runtime overhead.