]> err.no Git - varnish/commitdiff
Centralize <pthread_np.h> include, and use pthread_mutex_islocked_np() for
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 3 Feb 2008 22:26:25 +0000 (22:26 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 3 Feb 2008 22:26:25 +0000 (22:26 +0000)
ALOCKED() if available.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2418 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_main.c

index 2f88c25eb97706daf910e0dd26efa3b7e1a212c7..ae047fe25c285f33422860208086becd0f00d32e 100644 (file)
@@ -34,6 +34,9 @@
 #include <sys/socket.h>
 
 #include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
 #include <stdint.h>
 
 #include "vqueue.h"
@@ -657,10 +660,12 @@ do {                                                      \
 } while (0);
 #endif
 
-#ifdef DIAGNOSTICS
-#define ALOCKED(foo)           AN(pthread_mutex_trylock(foo))
+#if defined(HAVE_PTHREAD_MUTEX_ISLOCKED_NP)
+#define ALOCKED(mutex)         AN(pthread_mutex_islocked_np((mutex)))
+#elif defined(DIAGNOSTICS)
+#define ALOCKED(mutex)         AN(pthread_mutex_trylock((mutex)))
 #else
-#define ALOCKED(foo)           (void)(foo)
+#define ALOCKED(mutex)         (void)(mutex)
 #endif
 
 /*
index 738eb1469237116394ac049c46aaf29c25b041c9..1e85a45367ef240b278169cd1fff6c9df395a21b 100644 (file)
  * Name threads if our pthreads implementation supports it.
  */
 
-#ifdef HAVE_PTHREAD_NP_H
-#include <pthread_np.h>
-#endif
-
 void
 THR_Name(const char *name)
 {