aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-11-19 16:50:06 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-11-19 16:50:06 +0000
commit2113ae2d856a208350ccbafdc19e8dda322515b8 (patch)
tree5e865ee17c08e18bb91f769a36427dbcc1d6185f /src/libexpr
parent79aa7d95183cbe6c0d786965f0dbff414fd1aa67 (diff)
Make drv hash modulo memo table thread-safe
Let's get one step closer to the daemon not needing to fork.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/primops.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 236433ef1..41f06c219 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1132,9 +1132,10 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
However, we don't bother doing this for floating CA derivations because
their "hash modulo" is indeterminate until built. */
- if (drv.type() != DerivationType::CAFloating)
- drvHashes.insert_or_assign(drvPath,
- hashDerivationModulo(*state.store, Derivation(drv), false));
+ if (drv.type() != DerivationType::CAFloating) {
+ auto h = hashDerivationModulo(*state.store, Derivation(drv), false);
+ drvHashes.lock()->insert_or_assign(drvPath, h);
+ }
state.mkAttrs(v, 1 + drv.outputs.size());
mkString(*state.allocAttr(v, state.sDrvPath), drvPathS, {"=" + drvPathS});