initialize once

seems to fix the deadlocks?

Change-Id: Iac8b4247d2521250f18f54562d5696a566a6e71a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274028
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2020-02-28 09:56:39 -06:00 committed by Skia Commit-Bot
parent 5c5bd1a637
commit 856282a44e

View File

@ -2124,8 +2124,11 @@ namespace skvm {
llvm::WriteBitcodeToFile(*mod, os);
}
SkAssertResult(false == llvm::InitializeNativeTarget());
SkAssertResult(false == llvm::InitializeNativeTargetAsmPrinter());
static SkOnce once;
once([]{
SkAssertResult(false == llvm::InitializeNativeTarget());
SkAssertResult(false == llvm::InitializeNativeTargetAsmPrinter());
});
fEE = llvm::EngineBuilder(std::move(mod))
.setEngineKind(llvm::EngineKind::JIT)