summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-06-27 17:02:56 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-06-27 17:02:56 +0000
commitcab94301068f7655dea3728e74c58bf8e6220eeb (patch)
treea4d0ba512e5d5fa5732d84ca2f266cd1ca08c168 /include
parentfcfe9beca367e06d6b7b3b2de5f6ba015b031827 (diff)
Document DLA_UNLOCK and DLA_LOCK
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125895 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/lock.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 92299f3cd..475e49a99 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -289,6 +289,18 @@ int ast_find_lock_info(void *lock_addr, char *filename, size_t filename_size, in
} \
} while (0)
+/*!
+ * \brief Deadlock avoidance unlock
+ *
+ * In certain deadlock avoidance scenarios, there is more than one lock to be
+ * unlocked and relocked. Therefore, this pair of macros is provided for that
+ * purpose. Note that every DLA_UNLOCK _MUST_ be paired with a matching
+ * DLA_LOCK. The intent of this pair of macros is to be used around another
+ * set of deadlock avoidance code, mainly CHANNEL_DEADLOCK_AVOIDANCE, as the
+ * locking order specifies that we may safely lock a channel, followed by its
+ * pvt, with no worries about a deadlock. In any other scenario, this macro
+ * may not be safe to use.
+ */
#define DLA_UNLOCK(lock) \
do { \
char __filename[80], __func[80], __mutex_name[80]; \
@@ -296,6 +308,18 @@ int ast_find_lock_info(void *lock_addr, char *filename, size_t filename_size, in
int __res = ast_find_lock_info(lock, __filename, sizeof(__filename), &__lineno, __func, sizeof(__func), __mutex_name, sizeof(__mutex_name)); \
ast_mutex_unlock(lock);
+/*!
+ * \brief Deadlock avoidance lock
+ *
+ * In certain deadlock avoidance scenarios, there is more than one lock to be
+ * unlocked and relocked. Therefore, this pair of macros is provided for that
+ * purpose. Note that every DLA_UNLOCK _MUST_ be paired with a matching
+ * DLA_LOCK. The intent of this pair of macros is to be used around another
+ * set of deadlock avoidance code, mainly CHANNEL_DEADLOCK_AVOIDANCE, as the
+ * locking order specifies that we may safely lock a channel, followed by its
+ * pvt, with no worries about a deadlock. In any other scenario, this macro
+ * may not be safe to use.
+ */
#define DLA_LOCK(lock) \
if (__res < 0) { /* Shouldn't ever happen, but just in case... */ \
ast_mutex_lock(lock); \