r2416 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Sat Feb 2 11:58:05 CET 2008


Author: des
Date: 2008-02-02 11:58:05 +0100 (Sat, 02 Feb 2008)
New Revision: 2416

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
Log:
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.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2008-01-31 11:57:51 UTC (rev 2415)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2008-02-02 10:58:05 UTC (rev 2416)
@@ -657,6 +657,12 @@
 } 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.




More information about the varnish-commit mailing list