diff options
author | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-11-08 21:59:45 +0000 |
---|---|---|
committer | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-11-08 21:59:45 +0000 |
commit | fb8bf2401f36a960395a6d042c5b628492212207 (patch) | |
tree | 6a2a98c6735594eb33c87e844fc026a479577fc5 /res | |
parent | d57d481b760c9e51bb405c86ec098346aa166cdf (diff) |
Merged revisions 294277 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r294277 | jpeeler | 2010-11-08 15:58:13 -0600 (Mon, 08 Nov 2010) | 16 lines
Fix playback failure when using IAX with the timerfd module.
To fix this issue the alert pipe will now be used when the timerfd module is
in use. There appeared to be a race that was not solved by adding locking in the
timerfd module, but needed to be there anyway. The race was between the timer
being put in non-continuous mode in ast_read on the channel thread and the IAX
frame scheduler queuing a frame which would enable continuous mode before the
non-continuous mode event was read. This race for now is simply avoided.
(closes issue #18110)
Reported by: tpanton
Tested by: tpanton
I put tested by tpanton because it was tested on his hardware. Thanks for the
remote access to debug this issue!
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@294278 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_timing_timerfd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/res/res_timing_timerfd.c b/res/res_timing_timerfd.c index bffa007de..c9922aabe 100644 --- a/res/res_timing_timerfd.c +++ b/res/res_timing_timerfd.c @@ -140,6 +140,7 @@ static int timerfd_timer_set_rate(int handle, unsigned int rate) ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle); return -1; } + ao2_lock(our_timer); our_timer->saved_timer.it_value.tv_sec = 0; our_timer->saved_timer.it_value.tv_nsec = rate ? (long) (1000000000 / rate) : 0L; @@ -150,6 +151,7 @@ static int timerfd_timer_set_rate(int handle, unsigned int rate) res = timerfd_settime(handle, 0, &our_timer->saved_timer, NULL); } + ao2_unlock(our_timer); ao2_ref(our_timer, -1); return res; @@ -191,17 +193,20 @@ static int timerfd_timer_enable_continuous(int handle) ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle); return -1; } + ao2_lock(our_timer); if (our_timer->is_continuous) { /*It's already in continous mode, no need to do * anything further */ + ao2_unlock(our_timer); ao2_ref(our_timer, -1); return 0; } res = timerfd_settime(handle, 0, &continuous_timer, &our_timer->saved_timer); our_timer->is_continuous = 1; + ao2_unlock(our_timer); ao2_ref(our_timer, -1); return res; } @@ -217,6 +222,7 @@ static int timerfd_timer_disable_continuous(int handle) ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle); return -1; } + ao2_lock(our_timer); if(!our_timer->is_continuous) { /* No reason to do anything if we're not @@ -229,6 +235,7 @@ static int timerfd_timer_disable_continuous(int handle) res = timerfd_settime(handle, 0, &our_timer->saved_timer, NULL); our_timer->is_continuous = 0; memset(&our_timer->saved_timer, 0, sizeof(our_timer->saved_timer)); + ao2_unlock(our_timer); ao2_ref(our_timer, -1); return res; } @@ -244,6 +251,7 @@ static enum ast_timer_event timerfd_timer_get_event(int handle) ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle); return -1; } + ao2_lock(our_timer); if (our_timer->is_continuous) { res = AST_TIMING_EVENT_CONTINUOUS; @@ -251,6 +259,7 @@ static enum ast_timer_event timerfd_timer_get_event(int handle) res = AST_TIMING_EVENT_EXPIRED; } + ao2_unlock(our_timer); ao2_ref(our_timer, -1); return res; } |