summaryrefslogtreecommitdiff
path: root/channel.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-06-02 20:18:18 +0000
committerMark Spencer <markster@digium.com>2004-06-02 20:18:18 +0000
commitea2b6241fd1f61aeefbb06cb8196108b5fa37520 (patch)
tree7dcaf7da6989bb99bdd7e770c308f542518886a8 /channel.c
parentea70485e7bd45477526e7bd55272410bd8c86e04 (diff)
Lock while installign generator
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/channel.c b/channel.c
index 298f0e961..f31c01229 100755
--- a/channel.c
+++ b/channel.c
@@ -786,6 +786,8 @@ void ast_deactivate_generator(struct ast_channel *chan)
int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
{
+ int res = 0;
+ ast_mutex_lock(&chan->lock);
if (chan->generatordata) {
if (chan->generator && chan->generator->release)
chan->generator->release(chan, chan->generatordata);
@@ -795,9 +797,10 @@ int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen,
if ((chan->generatordata = gen->alloc(chan, params))) {
chan->generator = gen;
} else {
- return -1;
+ res = -1;
}
- return 0;
+ ast_mutex_unlock(&chan->lock);
+ return res;
}
int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception)