diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-27 12:32:02 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-27 12:32:02 +0000 |
commit | 975c2c2a25023c5977aea221f0d038e0aa4052ef (patch) | |
tree | 6feeb75bfdf5eee0f87c2505e08efe30ff18870f /channels/chan_local.c | |
parent | 21df00b4cf38973cbcb415b808b21dcfeec9eed7 (diff) |
Merged revisions 125741 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r125741 | tilghman | 2008-06-27 07:28:38 -0500 (Fri, 27 Jun 2008) | 15 lines
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
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@125742 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r-- | channels/chan_local.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index f574eab32..617cd2eb9 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -193,13 +193,13 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra while (other && ast_channel_trylock(other)) { ast_mutex_unlock(&p->lock); if (us && us_locked) { - ast_channel_unlock(us); - } - usleep(1); - if (us && us_locked) { - ast_channel_lock(us); + do { + CHANNEL_DEADLOCK_AVOIDANCE(us); + } while (ast_mutex_trylock(&p->lock)); + } else { + usleep(1); + ast_mutex_lock(&p->lock); } - ast_mutex_lock(&p->lock); other = isoutbound ? p->owner : p->chan; } @@ -516,7 +516,12 @@ static int local_hangup(struct ast_channel *ast) 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); |