From 67a6a85d32695e5c1bdee4a7d386d427130099d2 Mon Sep 17 00:00:00 2001 From: des Date: Sun, 3 Feb 2008 22:26:25 +0000 Subject: [PATCH] Centralize include, and use pthread_mutex_islocked_np() for 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 | 11 ++++++++--- varnish-cache/bin/varnishd/cache_main.c | 4 ---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 2f88c25e..ae047fe2 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -34,6 +34,9 @@ #include #include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif #include #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 /* diff --git a/varnish-cache/bin/varnishd/cache_main.c b/varnish-cache/bin/varnishd/cache_main.c index 738eb146..1e85a453 100644 --- a/varnish-cache/bin/varnishd/cache_main.c +++ b/varnish-cache/bin/varnishd/cache_main.c @@ -43,10 +43,6 @@ * Name threads if our pthreads implementation supports it. */ -#ifdef HAVE_PTHREAD_NP_H -#include -#endif - void THR_Name(const char *name) { -- 2.39.5