aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-04-07 14:43:18 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-04-07 14:43:18 +0000
commit4fa6fe76ba8ef733e00d93ae715d313284f85c6c (patch)
tree3d5f3c84a06c0df92004b496bd4cf4eefbed6f3c /channel.c
parent7998e161e794665532325764c9ab310839e93b69 (diff)
Remove double unlock from ast_read
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2647 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/channel.c b/channel.c
index 77b0fc82e..50aea5e0a 100755
--- a/channel.c
+++ b/channel.c
@@ -744,8 +744,9 @@ int ast_answer(struct ast_channel *chan)
-static void __ast_deactivate_generator(struct ast_channel *chan)
+void ast_deactivate_generator(struct ast_channel *chan)
{
+ ast_mutex_lock(&chan->lock);
if (chan->generatordata) {
if (chan->generator && chan->generator->release)
chan->generator->release(chan, chan->generatordata);
@@ -753,14 +754,9 @@ static void __ast_deactivate_generator(struct ast_channel *chan)
chan->generator = NULL;
chan->writeinterrupt = 0;
}
-}
-
-void ast_deactivate_generator(struct ast_channel *chan)
-{
- ast_mutex_lock(&chan->lock);
- __ast_deactivate_generator(chan);
ast_mutex_unlock(&chan->lock);
}
+
int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
{
if (chan->generatordata) {
@@ -1066,7 +1062,7 @@ struct ast_frame *ast_read(struct ast_channel *chan)
/* Stop if we're a zombie or need a soft hangup */
if (chan->zombie || ast_check_hangup(chan)) {
if (chan->generator)
- __ast_deactivate_generator(chan);
+ ast_deactivate_generator(chan);
ast_mutex_unlock(&chan->lock);
return NULL;
}
@@ -1200,7 +1196,7 @@ struct ast_frame *ast_read(struct ast_channel *chan)
if (!f) {
chan->_softhangup |= AST_SOFTHANGUP_DEV;
if (chan->generator)
- __ast_deactivate_generator(chan);
+ ast_deactivate_generator(chan);
/* End the CDR if appropriate */
if (chan->cdr)
ast_cdr_end(chan->cdr);
@@ -1225,15 +1221,12 @@ struct ast_frame *ast_read(struct ast_channel *chan)
tmp = chan->generatordata;
chan->generatordata = NULL;
generate = chan->generator->generate;
- ast_mutex_unlock(&chan->lock);
res = generate(chan, tmp, f->datalen, f->samples);
- ast_mutex_lock(&chan->lock);
chan->generatordata = tmp;
if (res) {
ast_log(LOG_DEBUG, "Auto-deactivating generator\n");
- __ast_deactivate_generator(chan);
+ ast_deactivate_generator(chan);
}
- ast_mutex_unlock(&chan->lock);
}
if (chan->fin & 0x80000000)
ast_frame_dump(chan->name, f, "<<");
@@ -1427,7 +1420,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
}
if (chan->generatordata) {
if (chan->writeinterrupt)
- __ast_deactivate_generator(chan);
+ ast_deactivate_generator(chan);
else {
ast_mutex_unlock(&chan->lock);
return 0;