aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-02 23:04:18 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-02 23:04:18 +0000
commit50770f97dc3696a4f9247d2d32c036791d1d3925 (patch)
treeb1930919fb3089107af16ff8600fb9882ae1d281
parenta2b83c00fb3c809a3b082603f52f1e6ec2f986ea (diff)
Merged revisions 179462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r179462 | russell | 2009-03-02 17:00:30 -0600 (Mon, 02 Mar 2009) | 16 lines Merged revisions 179461 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r179461 | russell | 2009-03-02 16:58:18 -0600 (Mon, 02 Mar 2009) | 8 lines 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.6.1@179464 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/channel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index b17bd6e29..118fc5b44 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2218,7 +2218,10 @@ int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const v
int res;
unsigned int real_rate = rate, max_rate;
+ ast_channel_lock(c);
+
if (c->timingfd == -1) {
+ ast_channel_unlock(c);
return -1;
}
@@ -2238,6 +2241,8 @@ int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const v
c->timingfunc = func;
c->timingdata = data;
+ ast_channel_unlock(c);
+
return res;
}