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

Quis custodiet ipsos custodes? #2150

Merged
merged 18 commits into from
May 4, 2019
Merged

Quis custodiet ipsos custodes? #2150

merged 18 commits into from
May 4, 2019

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented May 4, 2019

A mechanism for protecting the Ephemeris from ForgetBefore, not used yet. Will help with #2090.

@pleroy
Copy link
Member Author

pleroy commented May 4, 2019

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this move-only.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done.

Sorry, something went wrong.

// 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_);
Copy link
Member

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.

Sorry, something went wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I'd rather have an identifier that contains ForgetBefore for clarity.
  2. In tests, it's convenient to check that the right thing happens. Could also be useful in CHECKs.

@pleroy pleroy merged commit 177fca8 into mockingbirdnest:master May 4, 2019
@eggrobin eggrobin added the LGTM label May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants