diff options
author | Mark Michelson <mmichelson@digium.com> | 2008-05-13 23:54:01 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2008-05-13 23:54:01 +0000 |
commit | b6aef57619a75a1df65861270a63eb1515deb8ba (patch) | |
tree | e575d461d6a4d65e22429b98ed6207ac49994f28 /include/asterisk | |
parent | 739a3c88a502ab274adf47556adcb6a1f3ccaac6 (diff) |
Merged revisions 116088 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r116088 | mmichelson | 2008-05-13 18:47:49 -0500 (Tue, 13 May 2008) | 12 lines
A change to the way channel locks are handled when DEBUG_CHANNEL_LOCKS is defined.
After debugging a deadlock, it was noticed that when DEBUG_CHANNEL_LOCKS
is enabled in menuselect, the actual origin of channel locks is obscured
by the fact that all channel locks appear to happen in the function
ast_channel_lock(). This code change redefines ast_channel_lock to be a
macro which maps to __ast_channel_lock(), which then relays the proper
file name, line number, and function name information to the core lock
functions so that this information will be displayed in the case that
there is some sort of locking error or core show locks is issued.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/lock.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index f352a2d7d..cbc2926b3 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -1217,18 +1217,21 @@ AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), #define ast_channel_trylock(x) ast_mutex_trylock(&x->lock_dont_use) #else +#define ast_channel_lock(a) __ast_channel_lock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_lock(struct ast_channel *chan); +int __ast_channel_lock(struct ast_channel *chan, const char *file, int lineno, const char *func); +#define ast_channel_unlock(a) __ast_channel_unlock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Unlock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_unlock(struct ast_channel *chan); +int __ast_channel_unlock(struct ast_channel *chan, const char *file, int lineno, const char *func); +#define ast_channel_trylock(a) __ast_channel_trylock(a, __FILE__, __LINE__, __PRETTY_FUNCTION__) /*! \brief Lock AST channel (and print debugging output) \note You need to enable DEBUG_CHANNEL_LOCKS for this function */ -int ast_channel_trylock(struct ast_channel *chan); +int __ast_channel_trylock(struct ast_channel *chan, const char *file, int lineno, const char *func); #endif #endif /* _ASTERISK_LOCK_H */ |