You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2021/12/20 18:23:38 UTC

[qpid-dispatch] branch main updated: DISPATCH-2298: Avoid rescheduling qd_timer if we are already servicing timer

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
     new 6feb25e  DISPATCH-2298: Avoid rescheduling qd_timer if we are already servicing timer
6feb25e is described below

commit 6feb25e833768c41ea7cd6c17f2c61fe362aa4b8
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Mon Dec 6 15:58:46 2021 -0500

    DISPATCH-2298: Avoid rescheduling qd_timer if we are already servicing timer
    
    If we are in the middle of running through the list of timers in
    qd_timer_visit() we don't need to wake the timer as anything we add to
    the list will get serviced immediately in any case.
---
 src/timer.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/timer.c b/src/timer.c
index d015469..254cee5 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -249,7 +249,11 @@ void qd_timer_schedule(qd_timer_t *timer, qd_duration_t duration)
     }
 
     qd_timer_t *first = DEQ_HEAD(scheduled_timers);
-    qd_server_timeout(first->server, first->delta_time);
+    // Don't need to set timeout if qd_timer_visit is running on another thread now
+    // Because qd_timer_visit will itself deal with rescheduling the timers
+    if (!callback_thread) {
+        qd_server_timeout(first->server, first->delta_time);
+    }
     sys_mutex_unlock(lock);
 }
 

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