aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-13 23:47:49 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-13 23:47:49 +0000
commit3a6b342e1c906933c191b410e9d774fec936c28b (patch)
tree2734bfb5d029a6ef36dc422c19803fc886f057a5 /include
parentcffbde648458383efb0930d428fc72960e0af9d7 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@116088 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/lock.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index cc68a13aa..2570ee7bb 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -1196,18 +1196,21 @@ AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
struct ast_channel;
+#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 */