aboutsummaryrefslogtreecommitdiffstats
path: root/main/astobj2.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-12 16:33:24 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-12 16:33:24 +0000
commitcbdacb8c6cbe97eecc8d9e76f5cb9fdeb41ee12c (patch)
tree7543bc8865015bbb7df550e3c617a37e68fe6cdd /main/astobj2.c
parent957e2bd88eb39ccadb31da31886caabefdc3b707 (diff)
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. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@175122 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 032a232b8..6b664ccbb 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -170,14 +170,23 @@ int _ao2_unlock(void *user_data, const char *file, const char *func, int line, c
#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);