gallivm: Move LLVMStartMultithreaded() static initializer into gallivm 62/6462/1
authorTom Stellard <thomas.stellard@amd.com>
Tue, 30 Apr 2013 14:38:03 +0000 (07:38 -0700)
committerTom Stellard <thomas.stellard@amd.com>
Mon, 6 May 2013 16:06:03 +0000 (09:06 -0700)
This does not solve all of the problems with using LLVM in a
multithreaded enivronment, but it should help in some cases.

Reviewed-by: Mathias.Froehlich@web.de
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
src/gallium/drivers/radeon/radeon_llvm_emit.cpp

index a531d98..897f7ff 100644 (file)
 
 #include "lp_bld_misc.h"
 
+namespace {
+
+class LLVMEnsureMultithreaded {
+public:
+   LLVMEnsureMultithreaded()
+   {
+      if (!LLVMIsMultithreaded()) {
+         LLVMStartMultithreaded();
+      }
+   }
+};
+
+static LLVMEnsureMultithreaded lLVMEnsureMultithreaded;
+
+}
 
 extern "C" void
 lp_set_target_options(void)
index fb974f9..1012715 100644 (file)
 
 using namespace llvm;
 
-namespace {
-
-class LLVMEnsureMultithreaded {
-public:
-   LLVMEnsureMultithreaded()
-   {
-      llvm_start_multithreaded();
-   }
-};
-
-static LLVMEnsureMultithreaded lLVMEnsureMultithreaded;
-
-}
-
 /**
  * Set the shader type we want to compile
  *