Fix Windows build, don't try to #include <pthread.h> when we know it's not
authorNick Lewycky <nicholas@mxc.ca>
Mon, 14 Nov 2011 22:10:23 +0000 (22:10 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Mon, 14 Nov 2011 22:10:23 +0000 (22:10 +0000)
available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144574 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/ManagedStatic.cpp

index f1f03208c1f0a6f2bbe40362d89b7577bd1cad97..bfeb0a7b6fba8f9313191e0a7ca9cc42cde03dd0 100644 (file)
@@ -8,7 +8,10 @@
 //===----------------------------------------------------------------------===//
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Threading.h"
+#include "llvm/Config/config.h"
+#ifdef HAVE_PTHREAD_H
 #include <pthread.h>
+#endif
 
 #include "gtest/gtest.h"
 
@@ -16,6 +19,7 @@ using namespace llvm;
 
 namespace {
 
+#ifdef HAVE_PTHREAD_H
 namespace test1 {
   llvm::ManagedStatic<int> ms;
   void *helper(void*) {
@@ -35,5 +39,6 @@ TEST(Initialize, MultipleThreads) {
   pthread_join(t2, NULL);
   llvm_stop_multithreaded();
 }
+#endif
 
 } // anonymous namespace