r964 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Mon Sep 11 14:00:50 CEST 2006
Author: phk
Date: 2006-09-11 14:00:50 +0200 (Mon, 11 Sep 2006)
New Revision: 964
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
Log:
Embellish the mutex debugging a bit
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2006-09-11 11:55:00 UTC (rev 963)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2006-09-11 12:00:50 UTC (rev 964)
@@ -441,6 +441,24 @@
#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);
+#define LOCK(foo) \
+do { \
+ if (pthread_mutex_trylock(foo)) { \
+ VSL(SLT_Debug, 0, \
+ "MTX_CONTEST(%s,%s,%d," #foo ")", \
+ __func__, __FILE__, __LINE__); \
+ AZ(pthread_mutex_lock(foo)); \
+ } else { \
+ VSL(SLT_Debug, 0, \
+ "MTXLOCK(%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__); \
+} while (0);
#endif
More information about the varnish-commit
mailing list