From: phk Date: Sat, 16 Sep 2006 16:00:48 +0000 (+0000) Subject: fix debug locks X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=288f50710f36a8020aad06dcbd923ba40637014a;p=varnish fix debug locks git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1030 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 28973e91..b8d664cb 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -445,6 +445,9 @@ int RFC2616_cache_policy(struct sess *sp, struct http *hp); #define LOCK(foo) AZ(pthread_mutex_lock(foo)) #define UNLOCK(foo) AZ(pthread_mutex_unlock(foo)) #else +#define MTX pthread_mutex_t +#define MTX_INIT(foo) AZ(pthread_mutex_init(foo, NULL)) +#define MTX_DESTROY(foo) AZ(pthread_mutex_destroy(foo)) #define LOCK(foo) \ do { \ if (pthread_mutex_trylock(foo)) { \ @@ -452,17 +455,18 @@ do { \ "MTX_CONTEST(%s,%s,%d," #foo ")", \ __func__, __FILE__, __LINE__); \ AZ(pthread_mutex_lock(foo)); \ - } else { \ + } else if (1) { \ VSL(SLT_Debug, 0, \ - "MTX_LOCK(%s,%s,%d," #foo ")", \ + "MTX_LOCK(%s,%s,%d," #foo ")", \ __func__, __FILE__, __LINE__); \ } \ } while (0); #define UNLOCK(foo) \ do { \ AZ(pthread_mutex_unlock(foo)); \ - VSL(SLT_Debug, 0, \ - "MTX_UNLOCK(%s,%s,%d," #foo ")", \ - __func__, __FILE__, __LINE__); \ + if (1) \ + VSL(SLT_Debug, 0, \ + "MTX_UNLOCK(%s,%s,%d," #foo ")", \ + __func__, __FILE__, __LINE__); \ } while (0); #endif