]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix some bogus scheduler usage in chan_sip. This code used the return value
authorRussell Bryant <russell@russellbryant.com>
Tue, 26 Aug 2008 16:07:58 +0000 (16:07 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 26 Aug 2008 16:07:58 +0000 (16:07 +0000)
of a completely unrelated function to determine whether the scheduler should
be run or not.  This would have caused the scheduler to not run in cases where
it should have.  Also, leave a note about another scheduler issue that needs
to be addressed at some point.

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

channels/chan_sip.c

index b4e83d440307a4706fff91c6cde06605013c307b..5014f99357c4508e6ee05a230e13c4f28e4365d1 100644 (file)
@@ -16101,6 +16101,12 @@ restartsearch:
                }
                ast_mutex_unlock(&iflock);
 
+               /* XXX TODO The scheduler usage in this module does not have sufficient 
+                * synchronization being done between running the scheduler and places 
+                * scheduling tasks.  As it is written, any scheduled item may not run 
+                * any sooner than about  1 second, regardless of whether a sooner time 
+                * was asked for. */
+
                pthread_testcancel();
                /* Wait for sched or io */
                res = ast_sched_wait(sched);
@@ -16113,11 +16119,9 @@ restartsearch:
                if (option_debug && res > 20)
                        ast_log(LOG_DEBUG, "chan_sip: ast_io_wait ran %d all at once\n", res);
                ast_mutex_lock(&monlock);
-               if (res >= 0)  {
-                       res = ast_sched_runq(sched);
-                       if (option_debug && res >= 20)
-                               ast_log(LOG_DEBUG, "chan_sip: ast_sched_runq ran %d all at once\n", res);
-               }
+               res = ast_sched_runq(sched);
+               if (option_debug && res >= 20)
+                       ast_log(LOG_DEBUG, "chan_sip: ast_sched_runq ran %d all at once\n", res);
 
                /* Send MWI notifications to peers - static and cached realtime peers */
                t = time(NULL);