Lock evaluation scope when not created to prevent threading issues

This commit is contained in:
Deukhoofd 2019-01-22 16:53:22 +01:00
parent 750d5dab8d
commit 8bd5f7d0af
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 7 additions and 5 deletions

View File

@ -27,11 +27,13 @@ namespace Upsilon.StandardLibraries
{ {
if (_staticScope != null) if (_staticScope != null)
return _staticScope; return _staticScope;
lock (Scope)
var (evaluationScope, boundScope) = CreateStandardLibrary(); {
_staticScope = evaluationScope; var (evaluationScope, boundScope) = CreateStandardLibrary();
_staticBoundScope = boundScope; _staticScope = evaluationScope;
return _staticScope; _staticBoundScope = boundScope;
return _staticScope;
}
} }
} }