[svn-commits] tilghman: trunk r125741 - in /trunk: ./ channels/chan_local.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Jun 27 07:28:39 CDT 2008
Author: tilghman
Date: Fri Jun 27 07:28:38 2008
New Revision: 125741
URL: http://svn.digium.com/view/asterisk?view=rev&rev=125741
Log:
Merged revisions 125740 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r125740 | tilghman | 2008-06-27 07:19:39 -0500 (Fri, 27 Jun 2008) | 7 lines
Add proper deadlock avoidance.
(closes issue #12914)
Reported by: ozan
Patches:
20080625__bug12914.diff.txt uploaded by Corydon76 (license 14)
Tested by: ozan
........
Modified:
trunk/ (props changed)
trunk/channels/chan_local.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_local.c?view=diff&rev=125741&r1=125740&r2=125741
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Fri Jun 27 07:28:38 2008
@@ -219,13 +219,15 @@
/* Ensure that we have both channels locked */
while (other && ast_channel_trylock(other)) {
- DLA_UNLOCK(&p->lock);
+ ast_mutex_unlock(&p->lock);
if (us && us_locked) {
- CHANNEL_DEADLOCK_AVOIDANCE(us);
+ do {
+ CHANNEL_DEADLOCK_AVOIDANCE(us);
+ } while (ast_mutex_trylock(&p->lock));
} else {
usleep(1);
- }
- DLA_LOCK(&p->lock);
+ ast_mutex_lock(&p->lock);
+ }
other = isoutbound ? p->owner : p->chan;
}
@@ -542,7 +544,12 @@
if (!p)
return -1;
- ast_mutex_lock(&p->lock);
+ while (ast_mutex_trylock(&p->lock)) {
+ ast_channel_unlock(ast);
+ usleep(1);
+ ast_channel_lock(ast);
+ }
+
if (p->chan && ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE))
ast_set_flag(p->chan, AST_FLAG_ANSWERED_ELSEWHERE);
isoutbound = IS_OUTBOUND(ast, p);
More information about the svn-commits
mailing list