mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Merged revisions 86330 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r86330 | russell | 2007-10-18 13:03:10 -0500 (Thu, 18 Oct 2007) | 10 lines The channel needs to stay locked while running timer callbacks, as they access and modify channel data that may change elsewhere. I went through every timer callback in the source tree to make sure that none of them did any additional locking that could introduce deadlocks, and all is well. (closes issue #10765) Reported by: Ivan Patches: ast_1_4_11_svn_patch_channel_rc.diff uploaded by Ivan (license 229) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -181,6 +181,7 @@ typedef unsigned long long ast_group_t;
|
|||||||
struct ast_generator {
|
struct ast_generator {
|
||||||
void *(*alloc)(struct ast_channel *chan, void *params);
|
void *(*alloc)(struct ast_channel *chan, void *params);
|
||||||
void (*release)(struct ast_channel *chan, void *data);
|
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);
|
int (*generate)(struct ast_channel *chan, void *data, int len, int samples);
|
||||||
/*! This gets called when DTMF_END frames are read from the channel */
|
/*! This gets called when DTMF_END frames are read from the channel */
|
||||||
void (*digit)(struct ast_channel *chan, char digit);
|
void (*digit)(struct ast_channel *chan, char digit);
|
||||||
|
@@ -2210,17 +2210,13 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
|
|||||||
} else if (blah == ZT_EVENT_TIMER_EXPIRED) {
|
} else if (blah == ZT_EVENT_TIMER_EXPIRED) {
|
||||||
ioctl(chan->timingfd, ZT_TIMERACK, &blah);
|
ioctl(chan->timingfd, ZT_TIMERACK, &blah);
|
||||||
if (chan->timingfunc) {
|
if (chan->timingfunc) {
|
||||||
/* save a copy of func/data before unlocking the channel */
|
chan->timingfunc(chan->timingdata);
|
||||||
int (*func)(const void *) = chan->timingfunc;
|
|
||||||
void *data = chan->timingdata;
|
|
||||||
ast_channel_unlock(chan);
|
|
||||||
func(data);
|
|
||||||
} else {
|
} else {
|
||||||
blah = 0;
|
blah = 0;
|
||||||
ioctl(chan->timingfd, ZT_TIMERCONFIG, &blah);
|
ioctl(chan->timingfd, ZT_TIMERCONFIG, &blah);
|
||||||
chan->timingdata = NULL;
|
chan->timingdata = NULL;
|
||||||
ast_channel_unlock(chan);
|
|
||||||
}
|
}
|
||||||
|
ast_channel_unlock(chan);
|
||||||
/* cannot 'goto done' because the channel is already unlocked */
|
/* cannot 'goto done' because the channel is already unlocked */
|
||||||
return &ast_null_frame;
|
return &ast_null_frame;
|
||||||
} else
|
} else
|
||||||
|
Reference in New Issue
Block a user