summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-07-30 15:49:30 +0000
committerJoshua Colp <jcolp@digium.com>2007-07-30 15:49:30 +0000
commit3733874f49af1a9ed705052ea3f698d8e717c426 (patch)
tree9deabf8ad4adb677e902502711cb6b4085d71ff4 /main
parent9d959a040ee87ffe2dca9e4556340d4df272b5c5 (diff)
Merged revisions 77771 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r77771 | file | 2007-07-30 12:47:52 -0300 (Mon, 30 Jul 2007) | 6 lines (closes issue #10301) Reported by: fnordian Patches: asterisk-1.4.9-channel.c.patch uploaded by fnordian (license 110) Restore previous behavior where if we failed to lock the channel we wanted we would return to exactly the same point as if we had just reentered the function. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/channel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index c1b3b88ba..bc6041348 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -929,6 +929,7 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
const char *msg = prev ? "deadlock" : "initial deadlock";
int retries;
struct ast_channel *c;
+ const struct ast_channel *_prev = prev;
for (retries = 0; retries < 10; retries++) {
int done;
@@ -988,6 +989,11 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
AST_RWLIST_UNLOCK(&channels);
if (done)
return c;
+ /* If we reach this point we basically tried to lock a channel and failed. Instead of
+ * starting from the beginning of the list we can restore our saved pointer to the previous
+ * channel and start from there.
+ */
+ prev = _prev;
usleep(1); /* give other threads a chance before retrying */
}