Skip to content

engine: absl::Mutex + thread annotations in the read pool; Listing = StatusOr - #141

Merged
helly25 merged 1 commit into
mainfrom
fix/walk-thread-annotations
Jun 27, 2026
Merged

engine: absl::Mutex + thread annotations in the read pool; Listing = StatusOr#141
helly25 merged 1 commit into
mainfrom
fix/walk-thread-annotations

Conversation

@helly25

@helly25 helly25 commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Follow-up to #140 (parallel walk) addressing review feedback. Auto-merge intentionally not enabled - yours to review.

  • Listing was a hand-rolled StatusOr (a std::vector<Stated> plus an absl::Status with an implicit "not-ok means empty" invariant). Now absl::StatusOr<std::vector<Stated>>, which is exactly that shape and enforces the invariant by construction - matching ReadDir/Stat everywhere else.
  • Full thread-safety annotations on the read pool, switched to absl::Mutex:
    • queue_ / stop_ are ABSL_GUARDED_BY(mutex_).
    • the wait predicate Pending() is ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_).
    • Submit() / Run() are ABSL_LOCKS_EXCLUDED(mutex_) (must not be called holding it).
    • absl::Mutex::Await(Condition(&Pending)) replaces the condition_variable - a job becoming ready or stop_ flipping wakes waiters on unlock, so there is no separate signal to forget. (One mutex, so no lock-ordering annotations are needed.)

Verification

  • Builds clean under -Wthread-safety.
  • Full suite green under default, --config=clang --config=asan (asan+ubsan), and --config=clang --config=tsan.

…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.
@helly25
helly25 merged commit 94dd41a into main Jun 27, 2026
8 checks passed
@helly25
helly25 deleted the fix/walk-thread-annotations branch June 27, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant