-
Notifications
You must be signed in to change notification settings - Fork 69
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
Quis custodiet ipsos custodes? #2150
Conversation
retest this please |
@@ -286,6 +284,18 @@ class Ephemeris { | |||
static not_null<std::unique_ptr<Ephemeris>> ReadFromMessage( | |||
serialization::Ephemeris const& message) EXCLUDES(lock_); | |||
|
|||
// A |Guard| is an RAII object that protects a critical section against | |||
// changes to |t_min| due to calls to |TryToForgetBefore|. | |||
class Guard final { |
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.
Make this move-only.
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.
Good point, done.
physics/ephemeris.hpp
Outdated
// trajectories and returns true, after which |t_min() == t|. If the time |t| | ||
// is protected by a |Guard|, returns false; the actual action is delayed | ||
// until the destruction of the |Guard|. | ||
virtual bool TryToForgetBefore(Instant const& t) EXCLUDES(lock_); |
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.
This doesn't just try, it will eventually forget before t
; MarkForForgetting
?
In what circumstances would we use the result? ForgetBefore
only exists for performance purposes, I can't think of a case where we would do something differently if we cannot forget immediately.
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.
- I'd rather have an identifier that contains
ForgetBefore
for clarity. - In tests, it's convenient to check that the right thing happens. Could also be useful in
CHECK
s.
A mechanism for protecting the
Ephemeris
fromForgetBefore
, not used yet. Will help with #2090.