[svn-commits] tilghman: trunk r124966 - in /trunk: ./ channels/ include/asterisk/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 24 20:08:38 CDT 2008


Author: tilghman
Date: Tue Jun 24 20:08:37 2008
New Revision: 124966

URL: http://svn.digium.com/view/asterisk?view=rev&rev=124966
Log:
Merged revisions 124965 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r124965 | tilghman | 2008-06-24 19:46:24 -0500 (Tue, 24 Jun 2008) | 7 lines

Pvt deadlock causes some channels to get stuck in Reserved status.
(closes issue #12621)
 Reported by: fabianoheringer
 Patches: 
       20080612__bug12621.diff.txt uploaded by Corydon76 (license 14)
 Tested by: fabianoheringer

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_dahdi.c
    trunk/include/asterisk/lock.h

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

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=124966&r1=124965&r2=124966
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Tue Jun 24 20:08:37 2008
@@ -5196,10 +5196,11 @@
 	int index;
 	void *readbuf;
 	struct ast_frame *f;
-	
-
-	ast_mutex_lock(&p->lock);
-	
+
+	while (ast_mutex_trylock(&p->lock)) {
+		CHANNEL_DEADLOCK_AVOIDANCE(ast);
+	}
+
 	index = dahdi_get_index(ast, p, 0);
 	
 	/* Hang up if we don't really exist */

Modified: trunk/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/lock.h?view=diff&rev=124966&r1=124965&r2=124966
==============================================================================
--- trunk/include/asterisk/lock.h (original)
+++ trunk/include/asterisk/lock.h Tue Jun 24 20:08:37 2008
@@ -261,6 +261,20 @@
  * used during deadlock avoidance, to preserve the original location where
  * a lock was originally acquired.
  */
+#define CHANNEL_DEADLOCK_AVOIDANCE(chan) \
+	do { \
+		const char *__filename, *__func, *__mutex_name; \
+		int __lineno; \
+		int __res = ast_find_lock_info(&chan->lock_dont_use, &__filename, &__lineno, &__func, &__mutex_name); \
+		ast_channel_unlock(chan); \
+		usleep(1); \
+		if (__res < 0) { /* Shouldn't ever happen, but just in case... */ \
+			ast_channel_lock(chan); \
+		} else { \
+			__ast_pthread_mutex_lock(__filename, __lineno, __func, __mutex_name, &chan->lock_dont_use); \
+		} \
+	} while (0)
+
 #define DEADLOCK_AVOIDANCE(lock) \
 	do { \
 		const char *__filename, *__func, *__mutex_name; \
@@ -1404,6 +1418,11 @@
 }
 
 #else /* !DEBUG_THREADS */
+
+#define	CHANNEL_DEADLOCK_AVOIDANCE(chan) \
+	ast_channel_lock(chan); \
+	usleep(1); \
+	ast_channel_unlock(chan);
 
 #define	DEADLOCK_AVOIDANCE(lock) \
 	ast_mutex_lock(lock); \




More information about the svn-commits mailing list