Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0019B10A05 for ; Sat, 7 Sep 2013 02:27:48 +0000 (UTC) Received: (qmail 6977 invoked by uid 500); 7 Sep 2013 02:27:48 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 6948 invoked by uid 500); 7 Sep 2013 02:27:48 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 6941 invoked by uid 99); 7 Sep 2013 02:27:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Sep 2013 02:27:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Sep 2013 02:27:46 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9B0332388980; Sat, 7 Sep 2013 02:27:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1520721 - /qpid/trunk/qpid/extras/dispatch/src/server.c Date: Sat, 07 Sep 2013 02:27:25 -0000 To: commits@qpid.apache.org From: tross@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130907022725.9B0332388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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