because random crash happens if without the mutex
Signed-off-by: Homer Hsing <[email protected]>
---
backend/src/backend/program.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 281b0b8..4bece15 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -41,6 +41,7 @@
#include <sstream>
#include <iostream>
#include <unistd.h>
+#include <mutex>
/* Not defined for LLVM 3.0 */
#if !defined(LLVM_VERSION_MAJOR)
@@ -631,7 +632,10 @@ namespace gbe {
remove(clName.c_str());
// Now build the program from llvm
+ static std::mutex gbe_mutex;
+ gbe_mutex.lock();
gbe_program p = gbe_program_new_from_llvm(llName.c_str(), stringSize, err,
errSize);
+ gbe_mutex.unlock();
remove(llName.c_str());
return p;
}
--
1.8.3.2
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet