summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2007-08-27 22:41:00 +0000
committerMark Michelson <mmichelson@digium.com>2007-08-27 22:41:00 +0000
commit8176c0ee7cb29ba1005daec06243804f45e2ac35 (patch)
tree4952ba5eb98cdf2aa5756774a5afe38fa58116ae /apps
parent8b0c744786940ef5fa07ef5055506bdd27ba4c27 (diff)
Merged revisions 81158 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r81158 | mmichelson | 2007-08-27 17:40:19 -0500 (Mon, 27 Aug 2007) | 5 lines Resolve a potential deadlock. In this case, a single queue is locked, then the queue list. In changethread(), the queue list is locked, and then each individual queue is locked. Under the right circumstances, this could deadlock. As such, I have unlocked the individual queue before locking the queue list, and then locked the queue back after the queue list is unlocked. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index ced7933f9..a93147cac 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1198,7 +1198,9 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
} else {
q->members = next_m;
}
+ ast_mutex_unlock(&q->lock);
remove_from_interfaces(m->interface);
+ ast_mutex_lock(&q->lock);
q->membercount--;
ast_free(m);
} else {
@@ -1300,7 +1302,9 @@ static void update_realtime_members(struct call_queue *q)
} else {
q->members = next_m;
}
+ ast_mutex_unlock(&q->lock);
remove_from_interfaces(m->interface);
+ ast_mutex_lock(&q->lock);
q->membercount--;
free(m);
} else {