aboutsummaryrefslogtreecommitdiffstats
path: root/main/channel.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-30 15:47:52 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-30 15:47:52 +0000
commitffe4a02eeae9080e099c19bf8aee563859119503 (patch)
treee3d94b1f84bdd3485da120112ba749235a7e2671 /main/channel.c
parent20aadb7c834757c7992f073cab02ebed1e3acd84 (diff)
(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: http://svn.digium.com/svn/asterisk/branches/1.4@77771 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 7a5ca91dc..2289dd84a 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1032,6 +1032,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;
@@ -1093,6 +1094,11 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
AST_LIST_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 */
}