[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 09/25: Make `read-bytes' suspendable for socket reads on
From: |
Mike Gran |
Subject: |
[Guile-commits] 09/25: Make `read-bytes' suspendable for socket reads on MinGW. |
Date: |
Thu, 10 Nov 2022 18:06:17 -0500 (EST) |
mike121 pushed a commit to branch wip-mingw
in repository guile.
commit fe4e19a22aa1807473e6e39119ece02df9aa56c7
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Fri Mar 27 21:29:23 2020 +0100
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? "#<input-output: socket" (format #f "~a" port)))
(cond
- (((port-read port) port dst start count)
+ ((and (or (not (socket? port))
+ (pair? (car (select (list port) '() '() 0 0))))
+ ((port-read port) port dst start count))
=> (lambda (read)
(unless (<= 0 read count)
(error "bad return from port read function" read))
- [Guile-commits] branch wip-mingw updated (de06bc7bd -> 3c9052b26), Mike Gran, 2022/11/10
- [Guile-commits] 01/25: gnulib: Import the gethostname module., Mike Gran, 2022/11/10
- [Guile-commits] 08/25: squash! Fix 'absolute-file-name?' and others for cross-build to MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 10/25: Install 'mingw_take_signal' on MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 21/25: Revert "squash! Fix 'absolute-file-name?' and others for cross-build to MinGW.", Mike Gran, 2022/11/10
- [Guile-commits] 23/25: fixes for chmodat test, Mike Gran, 2022/11/10
- [Guile-commits] 06/25: Clear errno before CreateProcess for MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 04/25: Add 'set-port-binary/text-mode!' procedure for MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 03/25: mingw: canonicalize-path: Also canonicalize drive letter and '/'., Mike Gran, 2022/11/10
- [Guile-commits] 02/25: Link fix for MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 09/25: Make `read-bytes' suspendable for socket reads on MinGW.,
Mike Gran <=
- [Guile-commits] 11/25: Add `scm_sigaction_for_thread' stub for MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 12/25: DRAFT Add partial `scm_fcntl' support for MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 14/25: REMOVEME mingw: Hardcode compile-time-file-name-convention to 'mingw., Mike Gran, 2022/11/10
- [Guile-commits] 15/25: REMOVEME guix: guile-mingw: Hardcode file-name-convention., Mike Gran, 2022/11/10
- [Guile-commits] 16/25: DEBUG guile.cmd, wine-guile.sh: Some Wine help., Mike Gran, 2022/11/10
- [Guile-commits] 05/25: Support for x86_64-w64-mingw32., Mike Gran, 2022/11/10
- [Guile-commits] 07/25: Fix 'absolute-file-name?' and others for cross-build to MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 13/25: guix: Add guile-patched, guile-mingw., Mike Gran, 2022/11/10
- [Guile-commits] 19/25: For MinGW, use native signal func in sigaction, Mike Gran, 2022/11/10
- [Guile-commits] 22/25: Revert "Fix 'absolute-file-name?' and others for cross-build to MinGW.", Mike Gran, 2022/11/10