New functions for locking a channel - these simplify debugging

when you have channel locking issues.
(Part of the SIP transfer patch, where I had a *lot* of
channel locking problems)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20264 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2006-04-15 08:07:50 +00:00
parent 9250a6d129
commit 6b3367bf5c
4 changed files with 142 additions and 2 deletions

View File

@@ -761,4 +761,16 @@ AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
}
)
#ifndef DEBUG_CHANNEL_LOCKS
/*! \brief Lock a channel. If DEBUG_CHANNEL_LOCKS is defined
in the Makefile, print relevant output for debugging */
#define ast_channel_lock(x) ast_mutex_lock(x->lock);
/*! \brief Unlock a channel. If DEBUG_CHANNEL_LOCKS is defined
in the Makefile, print relevant output for debugging */
#define ast_channel_unlock(x) ast_mutex_unlock(x->lock);
/*! \brief Try locking a channel. If DEBUG_CHANNEL_LOCKS is defined
in the Makefile, print relevant output for debugging */
#define ast_channel_trylock(x) ast_mutex_trylock(x->lock);
#endif
#endif /* _ASTERISK_LOCK_H */