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: https://origsvn.digium.com/svn/asterisk/trunk@89293 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2007-11-15 16:20:47 +00:00
parent 139978dbb7
commit 09d9cce1d8
8 changed files with 30 additions and 30 deletions

View File

@@ -81,7 +81,7 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data)
res = ast_parseable_goto(chan2, args.label);
ast_mutex_unlock(&chan2->lock);
ast_channel_unlock(chan2);
quit:
return res;

View File

@@ -102,13 +102,13 @@ static int manager_play_dtmf(struct mansession *s, const struct message *m)
}
if (!digit) {
astman_send_error(s, m, "No digit specified");
ast_mutex_unlock(&chan->lock);
ast_channel_unlock(chan);
return 0;
}
ast_senddigit(chan, *digit, 0);
ast_mutex_unlock(&chan->lock);
ast_channel_unlock(chan);
astman_send_ack(s, m, "DTMF successfully queued");
return 0;

View File

@@ -104,11 +104,11 @@ static int softhangup_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "Soft hanging %s up.\n", c->name);
ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
if (!ast_test_flag(&flags, OPTION_ALL)) {
ast_mutex_unlock(&c->lock);
ast_channel_unlock(c);
break;
}
}
ast_mutex_unlock(&c->lock);
ast_channel_unlock(c);
}
return 0;