diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-28 22:39:26 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-28 22:39:26 +0000 |
commit | 020573b8ac5cacaef68586712538067febee0d67 (patch) | |
tree | 897a726d01e6359400224e1db3450880fcfe68ab /include | |
parent | d4718af66edfa3f0a64dc8a92cf24c8215fcb635 (diff) |
Merged revisions 105116 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r105116 | russell | 2008-02-28 16:23:05 -0600 (Thu, 28 Feb 2008) | 8 lines
Fix a bug in the lock tracking code that was discovered by mmichelson. The issue
is that if the lock history array was full, then the functions to mark a lock as
acquired or not would adjust the stats for whatever lock is at the end of the array,
which may not be itself. So, do a sanity check to make sure that we're updating
lock info for the proper lock.
(This explains the bizarre stats on lock #63 in BE-396, thanks Mark!)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@105144 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/lock.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index f9a6a5831..5d6ef43bb 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -154,12 +154,12 @@ void ast_store_lock_info(enum ast_lock_type type, const char *filename, /*! * \brief Mark the last lock as acquired */ -void ast_mark_lock_acquired(void); +void ast_mark_lock_acquired(void *lock_addr); /*! * \brief Mark the last lock as failed (trylock) */ -void ast_mark_lock_failed(void); +void ast_mark_lock_failed(void *lock_addr); /*! * \brief remove lock info for the current thread @@ -378,7 +378,7 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con } ast_reentrancy_unlock(t); if (t->track) - ast_mark_lock_acquired(); + ast_mark_lock_acquired(&t->mutex); } else { if (t->track) ast_remove_lock_info(&t->mutex); @@ -428,9 +428,9 @@ static inline int __ast_pthread_mutex_trylock(const char *filename, int lineno, } ast_reentrancy_unlock(t); if (t->track) - ast_mark_lock_acquired(); + ast_mark_lock_acquired(&t->mutex); } else if (t->track) { - ast_mark_lock_failed(); + ast_mark_lock_failed(&t->mutex); } return res; @@ -917,7 +917,7 @@ static inline int _ast_rwlock_rdlock(ast_rwlock_t *lock, const char *name, ast_store_lock_info(AST_RDLOCK, file, line, func, name, lock); res = pthread_rwlock_rdlock(lock); if (!res) - ast_mark_lock_acquired(); + ast_mark_lock_acquired(lock); else ast_remove_lock_info(lock); return res; @@ -948,7 +948,7 @@ static inline int _ast_rwlock_wrlock(ast_rwlock_t *lock, const char *name, ast_store_lock_info(AST_WRLOCK, file, line, func, name, lock); res = pthread_rwlock_wrlock(lock); if (!res) - ast_mark_lock_acquired(); + ast_mark_lock_acquired(lock); else ast_remove_lock_info(lock); return res; @@ -979,7 +979,7 @@ static inline int _ast_rwlock_tryrdlock(ast_rwlock_t *lock, const char *name, ast_store_lock_info(AST_RDLOCK, file, line, func, name, lock); res = pthread_rwlock_tryrdlock(lock); if (!res) - ast_mark_lock_acquired(); + ast_mark_lock_acquired(lock); else ast_remove_lock_info(lock); return res; @@ -1010,7 +1010,7 @@ static inline int _ast_rwlock_trywrlock(ast_rwlock_t *lock, const char *name, ast_store_lock_info(AST_WRLOCK, file, line, func, name, lock); res = pthread_rwlock_trywrlock(lock); if (!res) - ast_mark_lock_acquired(); + ast_mark_lock_acquired(lock); else ast_remove_lock_info(lock); return res; |