engine: absl::Mutex + thread annotations in the read pool; Listing = StatusOr - #141
Merged
Conversation
…g = StatusOr Follow-up to #140 addressing review feedback: - Listing was a hand-rolled StatusOr (vector + status with an implicit not-ok-means-empty invariant); make it absl::StatusOr<std::vector<Stated>>, matching ReadDir/Stat everywhere else. - ReadPool now uses absl::Mutex with full thread-safety annotations: queue_/stop_ are ABSL_GUARDED_BY(mutex_); the wait predicate Pending() is ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); Submit/Run are ABSL_LOCKS_EXCLUDED. absl::Mutex::Await replaces the condition_variable (a job becoming ready or stop_ wakes waiters on unlock), so there is no separate signal to forget. Builds clean under -Wthread-safety; full suite green under default, asan+ubsan, and tsan.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #140 (parallel walk) addressing review feedback. Auto-merge intentionally not enabled - yours to review.
Listingwas a hand-rolledStatusOr(astd::vector<Stated>plus anabsl::Statuswith an implicit "not-ok means empty" invariant). Nowabsl::StatusOr<std::vector<Stated>>, which is exactly that shape and enforces the invariant by construction - matchingReadDir/Stateverywhere else.absl::Mutex:queue_/stop_areABSL_GUARDED_BY(mutex_).Pending()isABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_).Submit()/Run()areABSL_LOCKS_EXCLUDED(mutex_)(must not be called holding it).absl::Mutex::Await(Condition(&Pending))replaces thecondition_variable- a job becoming ready orstop_flipping wakes waiters on unlock, so there is no separate signal to forget. (One mutex, so no lock-ordering annotations are needed.)Verification
-Wthread-safety.--config=clang --config=asan(asan+ubsan), and--config=clang --config=tsan.