diff --git a/common_clang.cpp b/common_clang.cpp index d5f0362b..a153661f 100644 --- a/common_clang.cpp +++ b/common_clang.cpp @@ -199,7 +199,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 @@ -211,6 +213,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); @@ -329,6 +334,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders, err_ostream.flush(); } { +#ifndef _WIN32 + llvm::sys::SmartScopedLock compileGuard{*compileMutex}; +#endif if (pBinaryResult) { *pBinaryResult = pResult.release(); }