Skip to content

Commit cf2b376

Browse files
committed
Added mutex into shared context
1 parent a387c73 commit cf2b376

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ydb/core/fq/libs/row_dispatcher/common.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "common.h"
22

3+
#include <util/system/mutex.h>
4+
35
#include <ydb/library/yql/public/purecalc/common/interface.h>
46

57
namespace NFq {
@@ -9,22 +11,21 @@ namespace {
911
class TPureCalcProgramFactory : public IPureCalcProgramFactory {
1012
public:
1113
NYql::NPureCalc::IProgramFactoryPtr GetFactory(const TSettings& settings) override {
14+
TGuard<TMutex> guard(FactoriesMutex);
15+
1216
const auto it = ProgramFactories.find(settings);
1317
if (it != ProgramFactories.end()) {
1418
return it->second;
1519
}
16-
return CreateFactory(settings);
17-
}
1820

19-
private:
20-
NYql::NPureCalc::IProgramFactoryPtr CreateFactory(const TSettings& settings) {
2121
return ProgramFactories.insert({settings, NYql::NPureCalc::MakeProgramFactory(
2222
NYql::NPureCalc::TProgramFactoryOptions()
2323
.SetLLVMSettings(settings.EnabledLLVM ? "ON" : "OFF")
2424
)}).first->second;
2525
}
2626

2727
private:
28+
TMutex FactoriesMutex;
2829
std::map<TSettings, NYql::NPureCalc::IProgramFactoryPtr> ProgramFactories;
2930
};
3031

0 commit comments

Comments
 (0)