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: https://origsvn.digium.com/svn/asterisk/branches/1.4@179461
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
{
int res = -1;
#ifdef HAVE_DAHDI
+ ast_channel_lock(c);
if (c->timingfd > -1) {
if (!func) {
samples = 0;
c->timingfunc = func;
c->timingdata = data;
}
+ ast_channel_unlock(c);
#endif
return res;
}