]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: avoid pthreads-win32 on mingw
authorEric Blake <eblake@redhat.com>
Wed, 9 Jun 2010 13:12:21 +0000 (07:12 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 10 Jun 2010 12:05:31 +0000 (06:05 -0600)
* src/util/threads.c (includes) [WIN32]: On mingw, favor native
threading over pthreads-win32 library.
* src/util/thread.h [WIN32] Likewise.
Suggested by Daniel P. Berrange.

src/util/threads-win32.c
src/util/threads.c
src/util/threads.h

index e478560c1591c57b02654e2e03d56cf0757ad640..fe1fcd062781b18dd7a6c719422adfb943c8a3c5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * threads-win32.c: basic thread synchronization primitives
  *
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index 8c0a91a607ffb4d4c9dd987d7b66dfef0987f028..4ebce568b08785d1eddb5c67c38103fb15e7d69e 100644 (file)
 
 #include "threads.h"
 
-#ifdef HAVE_PTHREAD_MUTEXATTR_INIT
+/* On mingw, we prefer native threading over the sometimes-broken
+ * pthreads-win32 library wrapper.  */
+#ifdef WIN32
+# include "threads-win32.c"
+#elif defined HAVE_PTHREAD_MUTEXATTR_INIT
 # include "threads-pthread.c"
 #else
-# ifdef WIN32
-#  include "threads-win32.c"
-# else
-#  error "Either pthreads or Win32 threads are required"
-# endif
+# error "Either pthreads or Win32 threads are required"
 #endif
index 8b2be8dbc8ad22f8d10d529795a08b25a8f58f68..db54ea011d21638b0de6f5a3b836e94bafe4acd0 100644 (file)
@@ -61,14 +61,12 @@ int virThreadLocalInit(virThreadLocalPtr l,
 void *virThreadLocalGet(virThreadLocalPtr l);
 void virThreadLocalSet(virThreadLocalPtr l, void*);
 
-# ifdef HAVE_PTHREAD_MUTEXATTR_INIT
+# ifdef WIN32
+#  include "threads-win32.h"
+# elif defined HAVE_PTHREAD_MUTEXATTR_INIT
 #  include "threads-pthread.h"
 # else
-#  ifdef WIN32
-#   include "threads-win32.h"
-#  else
-#   error "Either pthreads or Win32 threads are required"
-#  endif
+#  error "Either pthreads or Win32 threads are required"
 # endif
 
 #endif