From: phk Date: Mon, 11 Sep 2006 11:55:00 +0000 (+0000) Subject: Move LOCK/UNLOCK macros to cache.h where they belong. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94faf5594d847ffab70b07ed0dc6df6de5667b1f;p=varnish Move LOCK/UNLOCK macros to cache.h where they belong. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@963 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 94dca2a3..a6df67c3 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -433,3 +433,14 @@ cli_func_t cli_func_dump_pool; /* rfc2616.c */ int RFC2616_cache_policy(struct sess *sp, struct http *hp); + +#define LOCKSHM(foo) AZ(pthread_mutex_lock(foo)) +#define UNLOCKSHM(foo) AZ(pthread_mutex_unlock(foo)) + +#if 1 +#define LOCK(foo) AZ(pthread_mutex_lock(foo)) +#define UNLOCK(foo) AZ(pthread_mutex_unlock(foo)) +#else +#define LOCK(foo) do { AZ(pthread_mutex_lock(foo)); VSL(SLT_Debug, 0, "LOCK(%s,%s,%d," #foo ")", __func__, __FILE__, __LINE__); } while (0); +#define UNLOCK(foo) do { AZ(pthread_mutex_unlock(foo)); VSL(SLT_Debug, 0, "UNLOC(%s,%s,%d," #foo ")", __func__, __FILE__, __LINE__); } while (0); +#endif diff --git a/varnish-cache/include/libvarnish.h b/varnish-cache/include/libvarnish.h index bcb1e331..672549e2 100644 --- a/varnish-cache/include/libvarnish.h +++ b/varnish-cache/include/libvarnish.h @@ -56,14 +56,3 @@ void lbv_xxxassert(const char *, const char *, int, const char *, int); #define AN(foo) do { assert((foo) != NULL); } while (0) #define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) #define XXXAN(foo) do { xxxassert((foo) != NULL); } while (0) - -#define LOCKSHM(foo) AZ(pthread_mutex_lock(foo)) -#define UNLOCKSHM(foo) AZ(pthread_mutex_unlock(foo)) - -#if 1 -#define LOCK(foo) AZ(pthread_mutex_lock(foo)) -#define UNLOCK(foo) AZ(pthread_mutex_unlock(foo)) -#else -#define LOCK(foo) do { AZ(pthread_mutex_lock(foo)); VSL(SLT_Debug, 0, "LOCK(%s,%s,%d," #foo ")", __func__, __FILE__, __LINE__); } while (0); -#define UNLOCK(foo) do { AZ(pthread_mutex_unlock(foo)); VSL(SLT_Debug, 0, "UNLOC(%s,%s,%d," #foo ")", __func__, __FILE__, __LINE__); } while (0); -#endif