summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-10-05 16:49:16 +0000
committerRussell Bryant <russell@russellbryant.com>2007-10-05 16:49:16 +0000
commitfeb8f6f38bb127a80a5f1e4da8bb34fa4f1fe7c7 (patch)
treea4b0c576cda4a01c1dfa739369245c66cb61c4f9 /channels
parent40e7d22cd72cb1ed5e48dc67ce6cda9c6b0480d6 (diff)
Merged revisions 84783 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r84783 | russell | 2007-10-05 11:44:21 -0500 (Fri, 05 Oct 2007) | 4 lines Do deadlock avoidance in a couple more places. You can't lock two channels at the same time without doing extra work to make sure it succeeds. (closes issue #10895, patch by me) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@84784 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_zap.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index f3815e38e..db3ef8b39 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -3475,7 +3475,11 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
return AST_BRIDGE_FAILED_NOWARN;
ast_channel_lock(c0);
- ast_channel_lock(c1);
+ while (ast_channel_trylock(c1)) {
+ ast_channel_unlock(c0);
+ usleep(1);
+ ast_channel_lock(c0);
+ }
p0 = c0->tech_pvt;
p1 = c1->tech_pvt;
@@ -3641,8 +3645,13 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
/* Here's our main loop... Start by locking things, looking for private parts,
and then balking if anything is wrong */
+
ast_channel_lock(c0);
- ast_channel_lock(c1);
+ while (ast_channel_trylock(c1)) {
+ ast_channel_unlock(c0);
+ usleep(1);
+ ast_channel_lock(c0);
+ }
p0 = c0->tech_pvt;
p1 = c1->tech_pvt;