diff --git a/common_clang.cpp b/common_clang.cpp index f33f0918..d7ee616b 100644 --- a/common_clang.cpp +++ b/common_clang.cpp @@ -217,7 +217,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders, CommonClangInitialize(); try { +#ifdef _WIN32 llvm::sys::SmartScopedLock compileGuard{*compileMutex}; +#endif std::unique_ptr pResult(new OCLFEBinaryResult()); // Create the clang compiler @@ -229,6 +231,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders, // Prepare error log llvm::raw_string_ostream err_ostream(pResult->getLogRef()); { +#ifndef _WIN32 + llvm::sys::SmartScopedLock compileGuard{*compileMutex}; +#endif // Parse options optionsParser.processOptions(pszOptions, pszOptionsEx); @@ -357,6 +362,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders, err_ostream.flush(); } { +#ifndef _WIN32 + llvm::sys::SmartScopedLock compileGuard{*compileMutex}; +#endif if (pBinaryResult) { *pBinaryResult = pResult.release(); }