summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2006-04-15 08:07:50 +0000
committerOlle Johansson <oej@edvina.net>2006-04-15 08:07:50 +0000
commit6b3367bf5c22dda34d59dd2174f9555d3ad60a54 (patch)
tree8e37585dc242426cd3070d0e6771d0af748f60ca /include
parent9250a6d1290fdc21dd21fb43d5bd14532182d0ac (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/lock.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 97deac143..ab6dde3fc 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -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 */