From fe4e19a22aa1807473e6e39119ece02df9aa56c7 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 27 Mar 2020 21:29:23 +0100 Subject: Make `read-bytes' suspendable for socket reads on MinGW. On MinGW, port-read will block on sockets if no data is available. Avoid blocking by using select first. * module/ice-9/suspendable-ports.scm (read-bytes): For socket ports, guard port-read with select. --- module/ice-9/suspendable-ports.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/ice-9/suspendable-ports.scm b/module/ice-9/suspendable-ports.scm index a823f1d37..a451b63f1 100644 --- a/module/ice-9/suspendable-ports.scm +++ b/module/ice-9/suspendable-ports.scm @@ -68,8 +68,12 @@ (define (wait-for-writable port) ((current-write-waiter) port)) (define (read-bytes port dst start count) + (define (socket? port) + (string-prefix? "# (lambda (read) (unless (<= 0 read count) (error "bad return from port read function" read)) -- cgit v1.2.1