qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1520721 - /qpid/trunk/qpid/extras/dispatch/src/server.c
Date Sat, 07 Sep 2013 02:27:25 GMT
Author: tross
Date: Sat Sep  7 02:27:25 2013
New Revision: 1520721

URL: http://svn.apache.org/r1520721
Log:
QPID-4963 - Handle all pending (fired) timers rather than just one.

Modified:
    qpid/trunk/qpid/extras/dispatch/src/server.c

Modified: qpid/trunk/qpid/extras/dispatch/src/server.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/server.c?rev=1520721&r1=1520720&r2=1520721&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/server.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/server.c Sat Sep  7 02:27:25 2013
@@ -372,20 +372,35 @@ static void *thread_run(void *arg)
         //
         // Service pending timers.
         //
-        dx_timer_t *timer = DEQ_HEAD(dx_server->pending_timers);
-        if (timer) {
-            DEQ_REMOVE_HEAD(dx_server->pending_timers);
-
-            //
-            // Mark the timer as idle in case it reschedules itself.
-            //
-            dx_timer_idle_LH(timer);
+        if (DEQ_SIZE(dx_server->pending_timers) > 0) {
+            dx_timer_list_t local_list;
+            dx_timer_t *timer = DEQ_HEAD(dx_server->pending_timers);
+
+            DEQ_INIT(local_list);
+            while (timer) {
+                DEQ_REMOVE_HEAD(dx_server->pending_timers);
+                DEQ_INSERT_TAIL(local_list, timer);
+                timer = DEQ_HEAD(dx_server->pending_timers);
+            }
 
             //
-            // Release the lock and invoke the connection handler.
+            // Release the lock and invoke the connection handlers.
             //
             sys_mutex_unlock(dx_server->lock);
-            timer->handler(timer->context);
+
+            timer = DEQ_HEAD(local_list);
+            while (timer) {
+                DEQ_REMOVE_HEAD(local_list);
+
+                //
+                // Mark the timer as idle in case it reschedules itself.
+                //
+                dx_timer_idle_LH(timer);
+
+                timer->handler(timer->context);
+                timer = DEQ_HEAD(local_list);
+            }
+
             pn_driver_wakeup(dx_server->driver);
             continue;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message