Grab each lock individually...
authorMark Spencer <markster@digium.com>
Tue, 31 Aug 2004 21:55:19 +0000 (21:55 +0000)
committerMark Spencer <markster@digium.com>
Tue, 31 Aug 2004 21:55:19 +0000 (21:55 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3701 65c4cc65-6c06-0410-ace0-fbb531ad65f3

rtp.c

diff --git a/rtp.c b/rtp.c
index 07c022e..37027ec 100755 (executable)
--- a/rtp.c
+++ b/rtp.c
@@ -1327,7 +1327,11 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
        if (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))
                return -2;
        ast_mutex_lock(&c0->lock);
        if (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))
                return -2;
        ast_mutex_lock(&c0->lock);
-       ast_mutex_lock(&c1->lock);
+       while(ast_mutex_trylock(&c1->lock)) {
+               ast_mutex_unlock(&c0->lock);
+               usleep(1);
+               ast_mutex_lock(&c0->lock);
+       }
        pr0 = get_proto(c0);
        pr1 = get_proto(c1);
        if (!pr0) {
        pr0 = get_proto(c0);
        pr1 = get_proto(c1);
        if (!pr0) {