Lock everything that might need to be locked

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-08-11 20:47:48 +00:00
parent 886cf4f227
commit 0e2190687f

View File

@@ -131,13 +131,17 @@ static void check_bridge(struct local_pvt *p, int isoutbound)
/* Masquerade bridged channel into owner */
/* Lock other side first */
ast_pthread_mutex_lock(&p->chan->bridge->lock);
ast_pthread_mutex_lock(&p->owner->lock);
ast_channel_masquerade(p->owner, p->chan->bridge);
ast_pthread_mutex_unlock(&p->owner->lock);
ast_pthread_mutex_unlock(&p->chan->bridge->lock);
p->alreadymasqed = 1;
} else if (!isoutbound && p->owner && p->owner->bridge && p->chan) {
/* Masquerade bridged channel into chan */
ast_pthread_mutex_lock(&p->owner->bridge->lock);
ast_pthread_mutex_lock(&p->chan->lock);
ast_channel_masquerade(p->chan, p->owner->bridge);
ast_pthread_mutex_unlock(&p->chan->lock);
ast_pthread_mutex_unlock(&p->owner->bridge->lock);
p->alreadymasqed = 1;
}