]> err.no Git - varnish/commitdiff
Add an ALOCKED() macro which asserts that a mutex is locked. Unfortunately,
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 2 Feb 2008 10:58:05 +0000 (10:58 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 2 Feb 2008 10:58:05 +0000 (10:58 +0000)
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

index 787fca9805d44dc06569b299cc83be809b73d268..a3a34d6948681c0101d4e55dca07d2c87679c292 100644 (file)
@@ -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.