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
1.6.0
Joshua Colp 18 years ago
parent 9d959a040e
commit 3733874f49

@ -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 */
}

Loading…
Cancel
Save