[asterisk-commits] russell: trunk r184512 - in /trunk: include/asterisk/heap.h main/heap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 26 20:36:05 CDT 2009


Author: russell
Date: Thu Mar 26 20:35:56 2009
New Revision: 184512

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=184512
Log:
Pass more useful information through to lock tracking when DEBUG_THREADS is on.

Modified:
    trunk/include/asterisk/heap.h
    trunk/main/heap.c

Modified: trunk/include/asterisk/heap.h
URL: http://svn.digium.com/svn-view/asterisk/trunk/include/asterisk/heap.h?view=diff&rev=184512&r1=184511&r2=184512
==============================================================================
--- trunk/include/asterisk/heap.h (original)
+++ trunk/include/asterisk/heap.h Thu Mar 26 20:35:56 2009
@@ -209,6 +209,8 @@
  */
 size_t ast_heap_size(struct ast_heap *h);
 
+#ifndef DEBUG_THREADS
+
 /*!
  * \brief Write-Lock a heap
  *
@@ -247,6 +249,17 @@
  */
 int ast_heap_unlock(struct ast_heap *h);
 
+#else /* DEBUG_THREADS */
+
+#define ast_heap_wrlock(h) __ast_heap_wrlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+int __ast_heap_wrlock(struct ast_heap *h, const char *file, const char *func, int line);
+#define ast_heap_rdlock(h) __ast_heap_rdlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+int __ast_heap_rdlock(struct ast_heap *h, const char *file, const char *func, int line);
+#define ast_heap_unlock(h) __ast_heap_unlock(h, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+int __ast_heap_unlock(struct ast_heap *h, const char *file, const char *func, int line);
+
+#endif /* DEBUG_THREADS */
+
 /*!
  * \brief Verify that a heap has been properly constructed
  *

Modified: trunk/main/heap.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/heap.c?view=diff&rev=184512&r1=184511&r2=184512
==============================================================================
--- trunk/main/heap.c (original)
+++ trunk/main/heap.c Thu Mar 26 20:35:56 2009
@@ -302,6 +302,8 @@
 	return h->cur_len;
 }
 
+#ifndef DEBUG_THREADS
+
 int ast_heap_wrlock(struct ast_heap *h)
 {
 	return ast_rwlock_wrlock(&h->lock);
@@ -317,3 +319,21 @@
 	return ast_rwlock_unlock(&h->lock);
 }
 
+#else /* DEBUG_THREADS */
+
+int __ast_heap_wrlock(struct ast_heap *h, const char *file, const char *func, int line)
+{
+	return _ast_rwlock_wrlock(&h->lock, "&h->lock", file, line, func);
+}
+
+int __ast_heap_rdlock(struct ast_heap *h, const char *file, const char *func, int line)
+{
+	return _ast_rwlock_rdlock(&h->lock, "&h->lock", file, line, func);
+}
+
+int __ast_heap_unlock(struct ast_heap *h, const char *file, const char *func, int line)
+{
+	return _ast_rwlock_unlock(&h->lock, "&h->lock", file, line, func);
+}
+
+#endif /* DEBUG_THREADS */




More information about the asterisk-commits mailing list