aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/lock.h
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-16 23:53:02 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-16 23:53:02 +0000
commit865f310167e74f689ce4f84b5bb637475200aaf0 (patch)
treec4355e4b6f30b3bc2c0541983630411a784c0ebe /include/asterisk/lock.h
parentc71ab7923908b96826f40d7f88b5aee67f24c789 (diff)
(closes issue #13089)
Reported by: murf Most of this bug was already fixed by Tilghman before I opened it; Many thanks to Tilghman for his fix in svn version 125794. That fix cleared up some of the fields in the lock_info. This commit changes the address that is stored for the lock in the lock_info struct, so that it is the same as that passed into the locking macros. This makes searching for a lock_info (as in log_show_lock()) by its lock addr possible. The lock_addr field is infinitely more useful if it is the same as what is 'publicly' available outside the lock_info code. Many thanks to kpfleming, putnopvut, and Russell for their invaluable insights earlier today. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@131570 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/lock.h')
-rw-r--r--include/asterisk/lock.h78
1 files changed, 39 insertions, 39 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 33af56405..ae81fe46e 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -501,9 +501,9 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con
ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
bt = &lt->backtrace[lt->reentrancy];
ast_reentrancy_unlock(lt);
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
#else
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
#endif
}
@@ -565,7 +565,7 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con
}
ast_reentrancy_unlock(lt);
if (t->tracking) {
- ast_mark_lock_acquired(&t->mutex);
+ ast_mark_lock_acquired(t);
}
} else {
#ifdef HAVE_BKTR
@@ -577,11 +577,11 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con
bt = NULL;
}
if (t->tracking) {
- ast_remove_lock_info(&t->mutex, bt);
+ ast_remove_lock_info(t, bt);
}
#else
if (t->tracking) {
- ast_remove_lock_info(&t->mutex);
+ ast_remove_lock_info(t);
}
#endif
__ast_mutex_logger("%s line %d (%s): Error obtaining mutex: %s\n",
@@ -623,9 +623,9 @@ static inline int __ast_pthread_mutex_trylock(const char *filename, int lineno,
ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
bt = &lt->backtrace[lt->reentrancy];
ast_reentrancy_unlock(lt);
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
#else
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
#endif
}
@@ -643,10 +643,10 @@ static inline int __ast_pthread_mutex_trylock(const char *filename, int lineno,
}
ast_reentrancy_unlock(lt);
if (t->tracking) {
- ast_mark_lock_acquired(&t->mutex);
+ ast_mark_lock_acquired(t);
}
} else if (t->tracking) {
- ast_mark_lock_failed(&t->mutex);
+ ast_mark_lock_failed(t);
}
return res;
@@ -709,9 +709,9 @@ static inline int __ast_pthread_mutex_unlock(const char *filename, int lineno, c
if (t->tracking) {
#ifdef HAVE_BKTR
- ast_remove_lock_info(&t->mutex, bt);
+ ast_remove_lock_info(t, bt);
#else
- ast_remove_lock_info(&t->mutex);
+ ast_remove_lock_info(t);
#endif
}
@@ -806,9 +806,9 @@ static inline int __ast_cond_wait(const char *filename, int lineno, const char *
if (t->tracking) {
#ifdef HAVE_BKTR
- ast_remove_lock_info(&t->mutex, bt);
+ ast_remove_lock_info(t, bt);
#else
- ast_remove_lock_info(&t->mutex);
+ ast_remove_lock_info(t);
#endif
}
@@ -836,9 +836,9 @@ static inline int __ast_cond_wait(const char *filename, int lineno, const char *
if (t->tracking) {
#ifdef HAVE_BKTR
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
#else
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
#endif
}
}
@@ -903,9 +903,9 @@ static inline int __ast_cond_timedwait(const char *filename, int lineno, const c
if (t->tracking) {
#ifdef HAVE_BKTR
- ast_remove_lock_info(&t->mutex, bt);
+ ast_remove_lock_info(t, bt);
#else
- ast_remove_lock_info(&t->mutex);
+ ast_remove_lock_info(t);
#endif
}
@@ -933,9 +933,9 @@ static inline int __ast_cond_timedwait(const char *filename, int lineno, const c
if (t->tracking) {
#ifdef HAVE_BKTR
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex, bt);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
#else
- ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
+ ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
#endif
}
}
@@ -1115,9 +1115,9 @@ static inline int _ast_rwlock_unlock(ast_rwlock_t *t, const char *name,
if (t->tracking) {
#ifdef HAVE_BKTR
- ast_remove_lock_info(&t->lock, bt);
+ ast_remove_lock_info(t, bt);
#else
- ast_remove_lock_info(&t->lock);
+ ast_remove_lock_info(t);
#endif
}
@@ -1161,9 +1161,9 @@ static inline int _ast_rwlock_rdlock(ast_rwlock_t *t, const char *name,
ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
bt = &lt->backtrace[lt->reentrancy];
ast_reentrancy_unlock(lt);
- ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock, bt);
+ ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
#else
- ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock);
+ ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t);
#endif
}
@@ -1213,7 +1213,7 @@ static inline int _ast_rwlock_rdlock(ast_rwlock_t *t, const char *name,
}
ast_reentrancy_unlock(lt);
if (t->tracking) {
- ast_mark_lock_acquired(&t->lock);
+ ast_mark_lock_acquired(t);
}
} else {
#ifdef HAVE_BKTR
@@ -1225,11 +1225,11 @@ static inline int _ast_rwlock_rdlock(ast_rwlock_t *t, const char *name,
bt = NULL;
}
if (t->tracking) {
- ast_remove_lock_info(&t->lock, bt);
+ ast_remove_lock_info(t, bt);
}
#else
if (t->tracking) {
- ast_remove_lock_info(&t->lock);
+ ast_remove_lock_info(t);
}
#endif
__ast_mutex_logger("%s line %d (%s): Error obtaining read lock: %s\n",
@@ -1270,9 +1270,9 @@ static inline int _ast_rwlock_wrlock(ast_rwlock_t *t, const char *name,
ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
bt = &lt->backtrace[lt->reentrancy];
ast_reentrancy_unlock(lt);
- ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock, bt);
+ ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
#else
- ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock);
+ ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
#endif
}
#ifdef DETECT_DEADLOCKS
@@ -1321,7 +1321,7 @@ static inline int _ast_rwlock_wrlock(ast_rwlock_t *t, const char *name,
}
ast_reentrancy_unlock(lt);
if (t->tracking) {
- ast_mark_lock_acquired(&t->lock);
+ ast_mark_lock_acquired(t);
}
} else {
#ifdef HAVE_BKTR
@@ -1332,11 +1332,11 @@ static inline int _ast_rwlock_wrlock(ast_rwlock_t *t, const char *name,
bt = NULL;
}
if (t->tracking) {
- ast_remove_lock_info(&t->lock, bt);
+ ast_remove_lock_info(t, bt);
}
#else
if (t->tracking) {
- ast_remove_lock_info(&t->lock);
+ ast_remove_lock_info(t);
}
#endif
__ast_mutex_logger("%s line %d (%s): Error obtaining write lock: %s\n",
@@ -1378,9 +1378,9 @@ static inline int _ast_rwlock_tryrdlock(ast_rwlock_t *t, const char *name,
ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
bt = &lt->backtrace[lt->reentrancy];
ast_reentrancy_unlock(lt);
- ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock, bt);
+ ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
#else
- ast_store_lock_info(AST_RDLOCK, filename, line, func, name, &t->lock);
+ ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t);
#endif
}
@@ -1398,10 +1398,10 @@ static inline int _ast_rwlock_tryrdlock(ast_rwlock_t *t, const char *name,
}
ast_reentrancy_unlock(lt);
if (t->tracking) {
- ast_mark_lock_acquired(&t->lock);
+ ast_mark_lock_acquired(t);
}
} else if (t->tracking) {
- ast_mark_lock_failed(&t->lock);
+ ast_mark_lock_failed(t);
}
return res;
}
@@ -1438,9 +1438,9 @@ static inline int _ast_rwlock_trywrlock(ast_rwlock_t *t, const char *name,
ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
bt = &lt->backtrace[lt->reentrancy];
ast_reentrancy_unlock(lt);
- ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock, bt);
+ ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
#else
- ast_store_lock_info(AST_WRLOCK, filename, line, func, name, &t->lock);
+ ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
#endif
}
@@ -1458,10 +1458,10 @@ static inline int _ast_rwlock_trywrlock(ast_rwlock_t *t, const char *name,
}
ast_reentrancy_unlock(lt);
if (t->tracking) {
- ast_mark_lock_acquired(&t->lock);
+ ast_mark_lock_acquired(t);
}
} else if (t->tracking) {
- ast_mark_lock_failed(&t->lock);
+ ast_mark_lock_failed(t);
}
return res;
}