diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-25 23:19:31 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-25 23:19:31 +0000 |
commit | a3b507de3332feeada8df9839c242d8a7d17d614 (patch) | |
tree | 9cf5203ff622def8d4196c4841c104e1a2bffda6 /main | |
parent | e5122f6dca139efedab4aa4c7277976a7343f69c (diff) |
Merged revisions 104102 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r104102 | russell | 2008-02-25 17:19:05 -0600 (Mon, 25 Feb 2008) | 7 lines
Improve the lock tracking code a bit so that a bunch of old locks that threads
failed to lock don't sit around in the history. When a lock is first locked,
this checks to see if the last lock in the list was one that was failed to be
locked. If it is, then that was a lock that we're no longer sitting in a trylock
loop trying to lock, so just remove it.
(inspired by issue #11712)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@104103 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/utils.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/main/utils.c b/main/utils.c index f37dfb4a0..fcdd527dd 100644 --- a/main/utils.c +++ b/main/utils.c @@ -610,7 +610,16 @@ void ast_store_lock_info(enum ast_lock_type type, const char *filename, pthread_mutex_unlock(&lock_info->lock); return; } - + + if (i && lock_info->locks[i].pending == -1) { + /* The last lock on the list was one that this thread tried to lock but + * failed at doing so. It has now moved on to something else, so remove + * the old lock from the list. */ + i--; + lock_info->num_locks--; + memset(&lock_info->locks[i], 0, sizeof(lock_info->locks[0])); + } + lock_info->locks[i].file = filename; lock_info->locks[i].line_num = line_num; lock_info->locks[i].func = func; |