mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 21:16:02 +01:00
Make EvalState::callDepth thread-local
This is needed to make it thread-safe.
This commit is contained in:
parent
e8314e69ab
commit
67769e6fc1
2 changed files with 13 additions and 9 deletions
|
|
@ -1533,6 +1533,8 @@ void ExprLambda::eval(EvalState & state, Env & env, Value & v)
|
||||||
v.mkLambda(&env, this);
|
v.mkLambda(&env, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thread_local size_t EvalState::callDepth = 0;
|
||||||
|
|
||||||
void EvalState::callFunction(Value & fun, std::span<Value *> args, Value & vRes, const PosIdx pos)
|
void EvalState::callFunction(Value & fun, std::span<Value *> args, Value & vRes, const PosIdx pos)
|
||||||
{
|
{
|
||||||
auto _level = addCallDepth(pos);
|
auto _level = addCallDepth(pos);
|
||||||
|
|
|
||||||
|
|
@ -710,9 +710,11 @@ private:
|
||||||
std::shared_ptr<StaticEnv> & staticEnv);
|
std::shared_ptr<StaticEnv> & staticEnv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current Nix call stack depth, used with `max-call-depth` setting to throw stack overflow hopefully before we run out of system stack.
|
* Current Nix call stack depth, used with `max-call-depth`
|
||||||
|
* setting to throw stack overflow hopefully before we run out of
|
||||||
|
* system stack.
|
||||||
*/
|
*/
|
||||||
size_t callDepth = 0;
|
thread_local static size_t callDepth;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue