aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-15 16:20:47 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-15 16:20:47 +0000
commit6a4d64e3efa12ea468993aac9388d06c167e7b37 (patch)
tree893184ac838560b42d47dd3e9c413812c920645b /res
parentf8295541144551635f59cd789a768764e2266591 (diff)
access channel locks through ast_channel_lock/unlock/trylock and not
through ast_mutex primitives. To detect all occurrences, I have renamed the lock field in struct ast_channel so it is clear that it shouldn't be used directly. There are some uses in res/res_features.c (see details of the diff) that are error prone as they try and lock two channels without caring about the order (or without explaining why it is safe). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89293 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_features.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/res/res_features.c b/res/res_features.c
index d3235e592..5e1d3523f 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -2449,17 +2449,17 @@ static char mandescr_bridge[] =
static void do_bridge_masquerade(struct ast_channel *chan, struct ast_channel *tmpchan)
{
ast_moh_stop(chan);
- ast_mutex_lock(&chan->lock);
+ ast_channel_lock(chan);
ast_setstate(tmpchan, chan->_state);
tmpchan->readformat = chan->readformat;
tmpchan->writeformat = chan->writeformat;
ast_channel_masquerade(tmpchan, chan);
- ast_mutex_lock(&tmpchan->lock);
+ ast_channel_lock(tmpchan);
ast_do_masquerade(tmpchan);
/* when returning from bridge, the channel will continue at the next priority */
ast_explicit_goto(tmpchan, chan->context, chan->exten, chan->priority + 1);
- ast_mutex_unlock(&tmpchan->lock);
- ast_mutex_unlock(&chan->lock);
+ ast_channel_unlock(tmpchan);
+ ast_channel_unlock(chan);
}
/*!
@@ -2490,9 +2490,9 @@ static int action_bridge(struct mansession *s, const struct message *m)
chana = ast_get_channel_by_name_prefix_locked(channela, strlen(channela));
chanb = ast_get_channel_by_name_prefix_locked(channelb, strlen(channelb));
if (chana)
- ast_mutex_unlock(&chana->lock);
+ ast_channel_unlock(chana);
if (chanb)
- ast_mutex_unlock(&chanb->lock);
+ ast_channel_unlock(chanb);
/* send errors if any of the channels could not be found/locked */
if (!chana) {
@@ -3186,7 +3186,7 @@ static int bridge_exec(struct ast_channel *chan, void *data)
ast_module_user_remove(u);
return 0;
}
- ast_mutex_unlock(&current_dest_chan->lock);
+ ast_channel_unlock(current_dest_chan);
/* answer the channel if needed */
if (current_dest_chan->_state != AST_STATE_UP)