[Beignet] [PATCH] put a mutex around gbe_program_new_from_llvm
Yang, Rong R
rong.r.yang at intel.com
Thu Nov 14 00:26:12 PST 2013
LGTM, thanks.
-----Original Message-----
From: beignet-bounces at lists.freedesktop.org [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Homer Hsing
Sent: Tuesday, November 05, 2013 1:28 PM
To: beignet at lists.freedesktop.org
Subject: [Beignet] [PATCH] put a mutex around gbe_program_new_from_llvm
because random crash happens if without the mutex
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
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
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list