[asterisk-commits] rmudgett: trunk r333789 - in /trunk: ./ addons/ include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 29 16:17:56 CDT 2011


Author: rmudgett
Date: Mon Aug 29 16:17:51 2011
New Revision: 333789

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333789
Log:
Merged revisions 333786 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r333786 | rmudgett | 2011-08-29 16:12:29 -0500 (Mon, 29 Aug 2011) | 13 lines
  
  Merged revisions 333784-333785 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r333784 | rmudgett | 2011-08-29 16:05:43 -0500 (Mon, 29 Aug 2011) | 2 lines
    
    Fix deadlock potential of chan_mobile.c:mbl_ast_hangup().
  ........
    r333785 | rmudgett | 2011-08-29 16:06:16 -0500 (Mon, 29 Aug 2011) | 1 line
    
    Add some do not hold locks notes to channel.h
  ........
................

Modified:
    trunk/   (props changed)
    trunk/addons/chan_mobile.c
    trunk/include/asterisk/channel.h

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_mobile.c?view=diff&rev=333789&r1=333788&r2=333789
==============================================================================
--- trunk/addons/chan_mobile.c (original)
+++ trunk/addons/chan_mobile.c Mon Aug 29 16:17:51 2011
@@ -1318,21 +1318,10 @@
 
 static int mbl_ast_hangup(struct mbl_pvt *pvt)
 {
-	int res = 0;
-	for (;;) {
-		if (pvt->owner) {
-			if (ast_channel_trylock(pvt->owner)) {
-				DEADLOCK_AVOIDANCE(&pvt->lock);
-			} else {
-				res = ast_hangup(pvt->owner);
-				/* no need to unlock, ast_hangup() frees the
-				 * channel */
-				break;
-			}
-		} else
-			break;
-	}
-	return res;
+	if (pvt->owner) {
+		ast_hangup(pvt->owner);
+	}
+	return 0;
 }
 
 /*!

Modified: trunk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=333789&r1=333788&r2=333789
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Mon Aug 29 16:17:51 2011
@@ -1108,6 +1108,7 @@
  * \retval NULL failure
  * \retval non-NULL successfully allocated channel
  *
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
  * \note By default, new channels are set to the "s" extension
  *       and "default" context.
  */
@@ -1119,6 +1120,16 @@
 			    const char *file, int line, const char *function,
 			    const char *name_fmt, ...);
 
+/*!
+ * \brief Create a channel structure
+ *
+ * \retval NULL failure
+ * \retval non-NULL successfully allocated channel
+ *
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
+ * \note By default, new channels are set to the "s" extension
+ *       and "default" context.
+ */
 #define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, ...) \
 	__ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, \
 			    __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
@@ -1251,6 +1262,7 @@
  * if it is still there and also release the current reference to the channel.
  *
  * \return NULL, convenient for clearing invalid pointers
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
  *
  * \since 1.8
  */
@@ -1380,6 +1392,7 @@
 
 /*!
  * \brief Hang up a channel
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
  * \note This function performs a hard hangup on a channel.  Unlike the soft-hangup, this function
  * performs all stream stopping, etc, on the channel that needs to end.
  * chan is no longer valid after this call.
@@ -1960,7 +1973,9 @@
  * p->owner pointer) that is affected by the change.  The physical layer of the original
  * channel is hung up.
  *
- * \note Neither channel passed here needs to be locked before calling this function.
+ * \note Neither channel passed here should be locked before
+ * calling this function.  This function performs deadlock
+ * avoidance involving these two channels.
  */
 int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone);
 
@@ -2569,6 +2584,7 @@
  * This function executes a callback one time for each active channel on the
  * system.  The channel is provided as an argument to the function.
  *
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
  * \since 1.8
  */
 struct ast_channel *ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg,




More information about the asterisk-commits mailing list