diff options
author | David M. Lee <dlee@digium.com> | 2013-09-09 20:13:40 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-09-09 20:13:40 +0000 |
commit | c2e6e1ef49d8e8745c9e4b6be2601b210a34506f (patch) | |
tree | 000084953c842ca083e688bcf8f36eed0cfd9747 /include | |
parent | 0bcc676d09bbf11e02368ababe280795de61746d (diff) |
Fix DEBUG_THREADS when lock is acquired in __constructor__
This patch fixes some long-standing bugs in debug threads that were
exacerbated with recent Optional API work in Asterisk 12.
With debug threads enabled, on some systems, there's a lock ordering
problem between our mutex and glibc's mutex protecting its module list
(Ubuntu Lucid, glibc 2.11.1 in this instance). In one thread, the module
list will be locked before acquiring our mutex. In another thread, our
mutex will be locked before locking the module list (which happens in
the depths of calling backtrace()).
This patch fixes this issue by moving backtrace() calls outside of
critical sections that have the mutex acquired. The bigger change was to
reentrancy tracking for ast_cond_{timed,}wait, which wrongly assumed
that waiting on the mutex was equivalent to a single unlock (it actually
suspends all recursive locks on the mutex).
(closes issue ASTERISK-22455)
Review: https://reviewboard.asterisk.org/r/2824/
........
Merged revisions 398648 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 398649 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 398651 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/lock.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index aee084f32..d76a8d185 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -282,12 +282,16 @@ void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt); #else void ast_remove_lock_info(void *lock_addr); #endif /* HAVE_BKTR */ +void ast_suspend_lock_info(void *lock_addr); +void ast_restore_lock_info(void *lock_addr); #else #ifdef HAVE_BKTR #define ast_remove_lock_info(ignore,me) #else #define ast_remove_lock_info(ignore) #endif /* HAVE_BKTR */ +#define ast_suspend_lock_info(ignore); +#define ast_restore_lock_info(ignore); #endif /* !defined(LOW_MEMORY) */ /*! |