From b55397ea5ddb09dbeab355cbb81fa07f6fbd413f Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 27 Mar 2020 21:29:23 +0100 Subject: [PATCH] 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 9fac1df62..720f10c0f 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))