]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't move the time threshold for running scheduled events on every iteration.
authorRussell Bryant <russell@russellbryant.com>
Tue, 10 Aug 2010 18:04:32 +0000 (18:04 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 10 Aug 2010 18:04:32 +0000 (18:04 +0000)
Instead, only calculate the time threshold each time ast_sched_runq() is called.

(closes issue #17742)
Reported by: schmidts
Patches:
      sched.c.patch uploaded by schmidts (license 1077)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@281574 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/sched.c

index 8699cfbabc7d62154f64a2d14a965c5ade41c910..0aebb43f1cf948d5dd6cc93b2375d80da19d1210 100644 (file)
@@ -589,13 +589,13 @@ int ast_sched_runq(struct sched_context *con)
                
        ast_mutex_lock(&con->lock);
 
+       when = ast_tvadd(ast_tvnow(), ast_tv(0, 1000));
        for (numevents = 0; (current = ast_heap_peek(con->sched_heap, 1)); numevents++) {
                /* schedule all events which are going to expire within 1ms.
                 * We only care about millisecond accuracy anyway, so this will
                 * help us get more than one event at one time if they are very
                 * close together.
                 */
-               when = ast_tvadd(ast_tvnow(), ast_tv(0, 1000));
                if (ast_tvcmp(current->when, when) != -1) {
                        break;
                }