diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-30 15:49:30 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-30 15:49:30 +0000 |
commit | 8a73d0de9a9187441d9390b3cbd20094835293c7 (patch) | |
tree | 9deabf8ad4adb677e902502711cb6b4085d71ff4 /main | |
parent | 2cf27b3a3cdba4b8076060829611e930eb3a402f (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: http://svn.digium.com/svn/asterisk/trunk@77772 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/channel.c | 6 |
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 */ } |