[asterisk-commits] mmichelson: branch 1.6.0 r175122 - in /branches/1.6.0: ./ include/asterisk/ m...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 12 10:33:24 CST 2009
Author: mmichelson
Date: Thu Feb 12 10:33:24 2009
New Revision: 175122
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=175122
Log:
Merged revisions 175121 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r175121 | mmichelson | 2009-02-12 10:28:06 -0600 (Thu, 12 Feb 2009) | 11 lines
Make lock information for ao2_trylock be more useful and gnarly
Core show locks information involving an ao2_trylock did not
show the function that called ao2_trylock, but would instead
show ao2_trylock as the source of the lock. This is not useful
when trying to debug locking issues.
One bizarre note is that this logic is already in 1.4 but somehow
did not get merged to trunk or the 1.6.X branches.
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/include/asterisk/astobj2.h
branches/1.6.0/main/astobj2.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/include/asterisk/astobj2.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/include/asterisk/astobj2.h?view=diff&rev=175122&r1=175121&r2=175122
==============================================================================
--- branches/1.6.0/include/asterisk/astobj2.h (original)
+++ branches/1.6.0/include/asterisk/astobj2.h Thu Feb 12 10:33:24 2009
@@ -211,7 +211,19 @@
#define ao2_unlock(a) _ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
int _ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
#endif
-int ao2_trylock(void *user_data);
+
+/*! \brief
+ * Try locking-- (don't block if fail)
+ *
+ * \param a A pointer to the object we want to lock.
+ * \return 0 on success, other values on error.
+ */
+#ifndef DEBUG_THREADS
+int ao2_trylock(void *a);
+#else
+#define ao2_trylock(a) _ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
+int _ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
+#endif
/*!
*
Modified: branches/1.6.0/main/astobj2.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/main/astobj2.c?view=diff&rev=175122&r1=175121&r2=175122
==============================================================================
--- branches/1.6.0/main/astobj2.c (original)
+++ branches/1.6.0/main/astobj2.c Thu Feb 12 10:33:24 2009
@@ -170,14 +170,23 @@
#endif
}
+#ifndef DEBUG_THREADS
int ao2_trylock(void *user_data)
+#else
+int _ao2_trylock(void *user_data, const char *file, const char *func, int line, const char *var)
+#endif
{
struct astobj2 *p = INTERNAL_OBJ(user_data);
int ret;
if (p == NULL)
return -1;
- ret = ast_mutex_trylock(&p->priv_data.lock);
+#ifndef DEBUG_THREADS
+ ret = ast_mutex_trylock(&p->priv_data.lock);
+#else
+ ret = __ast_pthread_mutex_trylock(file, line, func, var, &p->priv_data.lock);
+#endif
+
#ifdef AO2_DEBUG
if (!ret)
ast_atomic_fetchadd_int(&ao2.total_locked, 1);
More information about the asterisk-commits
mailing list