summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2006-03-23 23:57:18 +0000
committerKevin P. Fleming <kpfleming@digium.com>2006-03-23 23:57:18 +0000
commitc26786fd81515ee0179135bae2c00df4f07e6aec (patch)
tree43394995549022aacb3f80b277132e6bd6af7b3a
parent39464dfe09d9c79cd47a017d99ef168868da98d4 (diff)
compute scheduler thread timeout properly
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@14573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_iax2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 042dbf4b1..d8995c696 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -8264,13 +8264,16 @@ static void *sched_thread(void *ignore)
{
int count;
int res;
+ struct timeval tv;
struct timespec ts;
for (;;) {
res = ast_sched_wait(sched);
if ((res > 1000) || (res < 0))
res = 1000;
- ts.tv_sec = res;
+ tv = ast_tvadd(ast_tvnow(), ast_samp2tv(res, 1000));
+ ts.tv_sec = tv.tv_sec;
+ ts.tv_nsec = tv.tv_usec * 1000;
ast_mutex_lock(&sched_lock);
ast_cond_timedwait(&sched_cond, &sched_lock, &ts);