Skip to content

libstore: refactor tryToBuild with coroutine lambdas and RAII#15274

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:tryToBuild-raii
Feb 17, 2026
Merged

libstore: refactor tryToBuild with coroutine lambdas and RAII#15274
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:tryToBuild-raii

Conversation

@amaanq
Copy link
Member

@amaanq amaanq commented Feb 17, 2026

Motivation

tryToBuild threaded a single PathLocks outputLocks by reference across all build phases and managed a std::unique_ptr<Activity> actLock with explicit if (!actLock) guards and .reset() calls around the hook retry loop. This commit introduces coroutine lambdas for the three phases: tryHookLoop owns a PathLocks in a scoped block for the first attempt and per-iteration in the retry loop, tryBuildLocally acquires its own PathLocks, and the hook-wait Activity is a stack variable scoped to the postpone block.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@amaanq amaanq requested a review from Ericson2314 as a code owner February 17, 2026 19:38
@amaanq amaanq force-pushed the tryToBuild-raii branch 7 times, most recently from 9ee527c to d77e085 Compare February 17, 2026 21:22
`tryToBuild` threaded a single `PathLocks outputLocks` by reference
across all build phases and managed a `std::unique_ptr<Activity> actLock`
with explicit `if (!actLock)` guards and `.reset()` calls around the hook
retry loop. This commit introduces coroutine lambdas for the three phases:
`tryHookLoop` owns a `PathLocks` in a scoped block for the first attempt
and per-iteration in the retry loop, `tryBuildLocally` acquires its own
`PathLocks`, and the hook-wait `Activity` is a stack variable scoped to
the postpone block.
@Ericson2314 Ericson2314 added this pull request to the merge queue Feb 17, 2026
Merged via the queue into NixOS:master with commit 4fff871 Feb 17, 2026
14 checks passed
@Ericson2314 Ericson2314 deleted the tryToBuild-raii branch February 17, 2026 22:55
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.

2 participants