aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-02 22:58:18 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-02 22:58:18 +0000
commit2736bc484101820cfbc1ee76d077c6bafb561b29 (patch)
treebc64f7b3ed1e564233ab7637027662b8b7ea4bae /main
parentb25302b53e87af89310bd57e07924fd7dff208ce (diff)
Ensure that only one thread is calling ast_settimeout() on a channel at a time.
For example, with an IAX2 channel, you can have both the channel thread and the chan_iax2 processing threads calling this function, and doing so twice at the same time is a bad thing. (Found in a debugging session with dvossel and mmichelson) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@179461 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 25d45ec0d..33f7558f7 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1839,6 +1839,7 @@ int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *d
{
int res = -1;
#ifdef HAVE_DAHDI
+ ast_channel_lock(c);
if (c->timingfd > -1) {
if (!func) {
samples = 0;
@@ -1850,6 +1851,7 @@ int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *d
c->timingfunc = func;
c->timingdata = data;
}
+ ast_channel_unlock(c);
#endif
return res;
}