~ chicken-core (chicken-5) fe1448856f6e6a0ef830391dcc3683864faaa089
commit fe1448856f6e6a0ef830391dcc3683864faaa089 Author: Peter Bex <peter@more-magic.net> AuthorDate: Mon Sep 28 17:01:10 2015 +0200 Commit: Peter Bex <peter@more-magic.net> CommitDate: Mon Sep 28 17:09:26 2015 +0200 Always call fdset_add for every entry in ##sys#fd-list, to ensure positions match. In some situations (forced interrupt handler onto primordial thread?) fd-list may have items that aren't waiting for an fd to become ready for read/write. diff --git a/scheduler.scm b/scheduler.scm index f89805fa..8c0976cd 100644 --- a/scheduler.scm +++ b/scheduler.scm @@ -393,6 +393,8 @@ EOF (for-each (lambda (t) (let ((p (##sys#slot t 11))) + ;; XXX: This should never be false, because otherwise the + ;; thread is not supposed to be on ##sys#fd-list! (when (pair? p) ; (FD . RWFLAGS)? (can also be mutex or thread) (let ((i/o (cdr p))) (case i/o @@ -407,8 +409,9 @@ EOF (panic (sprintf "create-fdset: invalid i/o direction: ~S (fd = ~S)" i/o fd)))))))) (cdar lst)) - (when (or input output) - ((foreign-lambda void "C_fdset_add" int bool bool) fd input output)) + ;; Our position in fd-list must match fdset array position, so + ;; always add an fdset entry, even if input & output are #f. + ((foreign-lambda void "C_fdset_add" int bool bool) fd input output) (loop (cdr lst)))))) (define (fdset-test inf outf i/o)Trap