Fixes for last patch. Sorry, this had to happen sooner or later.
This patch just fixes use of outdates predicates. Cheers /Jörg BTW: Interesting that this did work to some extend. (#1 reason to begin with the timeout queue was that the original code still uses fixnum timeouts for backward compatibility). Am 20.02.2016 um 18:54 schrieb Jörg F. Wittenberger: > Am 19.02.2016 um 22:39 schrieb Jörg F. Wittenberger: >> ... >>> I opened ticket 1259 for this. >>> >>> To make the kind reviewers job easier, I'll post diffs in piecemeal here. > > This patch goes after killing a single - but important - comment line in > scheduler.scm: > > ;; This should really use a balanced tree: > > Now it does. > > This patch replaces the timeout queue with a balanced tree. > > > It does not matter so much, which kind of tree we use. But a > linear list is really a bad choice. > > Assume you have a tcp-server alike: 100 client connections and > you read the next input line. It's probably (but not sure) already > in the OS's buffer. But chicken core will nevertheless establish a > timeout. The latter will so far traverse the (linear) timeout > queue. Chances are all those other timeouts are prior established > reads using the same timeout too. Thus you find the insert point > right at the end. > > > If you have an application which makes heavy use of chicken's core tcp > unit (I don't use chicken's timeouts at all for this, I do use them, but > only via thread-sleep!) I'd be interested to hear how much good or bad > this patch does for you. > > Cheers > > /Jörg
>From 697b8780cb57a9720affc8216d194c211fdef49a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20F=2E=20Wittenberger?= <joerg.wittenber...@softeyes.net> Date: Sat, 20 Feb 2016 19:15:26 +0100 Subject: [PATCH] Fix missuse of predicate --- scheduler.scm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scheduler.scm b/scheduler.scm index 997668f..7081acf 100644 --- a/scheduler.scm +++ b/scheduler.scm @@ -334,8 +334,7 @@ EOF (let ((entry (make-timeout-list-entry tm (list t)))) (##sys#setslot t 4 entry) (set! ##sys#timeout-list-head entry))) - ((fx> tm - (prio-queue-node-index ##sys#timeout-list-head)) + ((timeout< (prio-queue-node-index ##sys#timeout-list-head) tm) (let ((entry (timeout-queue-node-lookup ##sys#timeout-list tm))) (if entry (begin @@ -346,8 +345,7 @@ EOF (let ((entry (make-timeout-list-entry tm (list t)))) (##sys#setslot t 4 entry) (timeout-queue-node-insert! ##sys#timeout-list entry))))) - ((fx< tm - (prio-queue-node-index ##sys#timeout-list-head)) + ((timeout< tm (prio-queue-node-index ##sys#timeout-list-head)) (timeout-queue-node-insert! ##sys#timeout-list ##sys#timeout-list-head) (let ((entry (make-timeout-list-entry tm (list t)))) @@ -535,7 +533,7 @@ dunno what to do ;; Sleep for the number of milliseconds of next thread ;; to wake up. (let ((tmo (prio-queue-node-index (timeout-queue-next)))) - (##core#inline "C_msleep" (fxmax 0 (##core#inline "C_quickflonumtruncate" (fp- tmo now)))) ))))) + (##core#inline "C_msleep" (fpmax 0 (##core#inline "C_quickflonumtruncate" (fp- tmo now)))) ))))) (define (##sys#thread-block-for-timeout! t tm) (dbg t " blocks for timeout " tm) -- 2.6.2
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers