gallivm: Move LLVMStartMultithreaded() static initializer into gallivm
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 a531d98e881f5ed223f5e88df5c9eb6271bb4f7f..897f7ffb276ebc76beb3ea38ed22160cbb21e97d 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 fb974f91ac29cc9c3c84092f9c705ee130cf652c..10127151b10839e37c00c05e36a362302b919a54 100644 (file)
 
 using namespace llvm;
 
-namespace {
-
-class LLVMEnsureMultithreaded {
-public:
-   LLVMEnsureMultithreaded()
-   {
-      llvm_start_multithreaded();
-   }
-};
-
-static LLVMEnsureMultithreaded lLVMEnsureMultithreaded;
-
-}
-
 /**
  * Set the shader type we want to compile
  *