Merged revisions 118953 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118953 | tilghman | 2008-05-29 12:20:16 -0500 (Thu, 29 May 2008) | 3 lines

Add some debugging code that ensures that when we do deadlock avoidance, we
don't lose the information about how a lock was originally acquired.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-05-29 17:35:19 +00:00
parent 9a535bd115
commit 6e5d843a71
7 changed files with 78 additions and 53 deletions

View File

@@ -677,6 +677,34 @@ void ast_mark_lock_failed(void *lock_addr)
#ifdef HAVE_BKTR
void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt)
#else
int ast_find_lock_info(void *lock_addr, const char **filename, int *lineno, const char **func, const char **mutex_name)
{
struct thr_lock_info *lock_info;
int i = 0;
if (!(lock_info = ast_threadstorage_get(&thread_lock_info, sizeof(*lock_info))))
return -1;
pthread_mutex_lock(&lock_info->lock);
for (i = lock_info->num_locks - 1; i >= 0; i--) {
if (lock_info->locks[i].lock_addr == lock_addr)
break;
}
if (i == -1) {
/* Lock not found :( */
pthread_mutex_unlock(&lock_info->lock);
return -1;
}
*filename = lock_info->locks[i].file;
*lineno = lock_info->locks[i].line_num;
*func = lock_info->locks[i].func;
*mutex_name = lock_info->locks[i].lock_name;
return 0;
}
void ast_remove_lock_info(void *lock_addr)
#endif
{