struct ast_generator {
void *(*alloc)(struct ast_channel *chan, void *params);
void (*release)(struct ast_channel *chan, void *data);
+ /*! This function gets called with the channel locked */
int (*generate)(struct ast_channel *chan, void *data, int len, int samples);
};
} else if (blah == ZT_EVENT_TIMER_EXPIRED) {
ioctl(chan->timingfd, ZT_TIMERACK, &blah);
if (chan->timingfunc) {
- /* save a copy of func/data before unlocking the channel */
- int (*func)(const void *) = chan->timingfunc;
- void *data = chan->timingdata;
- ast_channel_unlock(chan);
- func(data);
+ chan->timingfunc(chan->timingdata);
} else {
blah = 0;
ioctl(chan->timingfd, ZT_TIMERCONFIG, &blah);
chan->timingdata = NULL;
- ast_channel_unlock(chan);
}
+ ast_channel_unlock(chan);
/* cannot 'goto done' because the channel is already unlocked */
return &ast_null_frame;
} else