From 499c372dd233a37b74e8774607aad013355a3f23 Mon Sep 17 00:00:00 2001 From: des Date: Sat, 2 Feb 2008 10:58:05 +0000 Subject: [PATCH] Add an ALOCKED() macro which asserts that a mutex is locked. Unfortunately, there is no portable way to do this, so we have to fake it by trying to lock the mutex and assert that it fails. This can be very expensive, so we only do it when built with --enable-diagnostics. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2416 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 787fca98..a3a34d69 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -657,6 +657,12 @@ do { \ } while (0); #endif +#ifdef DIAGNOSTICS +#define ALOCKED(foo) AN(pthread_mutex_trylock(foo)) +#else +#define ALOCKED(foo) (void)(foo) +#endif + /* * A normal pointer difference is signed, but we never want a negative value * so this little tool will make sure we don't get that. -- 2.39.5