guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Tue, 9 May 2023 10:28:16 -0400 (EDT)

branch: master
commit 9dc92c37f8465dbc7b0fa83fd2c4b90365bb6021
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue May 9 09:56:44 2023 +0200

    build: Require Guile >= 3.0.6.
    
    * configure.ac: Require Guile >= 3.0.6.
    * src/cuirass/base.scm (read/non-blocking): Remove.
    (evaluate): Adjust accordingly.
---
 configure.ac         |  4 ++++
 src/cuirass/base.scm | 14 +-------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 29e8a4c..b36b4dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,10 @@ AC_PROG_SED
 
 GUILE_PKG([3.0])
 
+dnl Guile 3.0.6 introduced 'read' in Scheme, which cooperates with
+dnl Fibers (it can be suspended).
+PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.6])
+
 AC_PATH_PROG([GUILE], [guile])
 AC_PATH_PROG([GUILD], [guild])
 AS_IF([test -z "$ac_cv_path_GUILD"],
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 4fb0e6c..382e51e 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -219,18 +219,6 @@ any."
     (fcntl port F_SETFL (logior O_NONBLOCK flags))
     port))
 
-(define (read/non-blocking port)
-  "Like 'read', but uses primitives that don't block and thus play well with
-fibers."
-  ;; XXX: Since 'read' is not suspendable as of Guile 2.2.3, we use
-  ;; 'read-string' (which is suspendable) and then 'read'.
-  (setvbuf port 'block 4096)                   ;'read-string' uses 'read-char'
-  (match (read-string port)
-    ((? eof-object? eof)
-     eof)
-    ((? string? data)
-     (call-with-input-string data read))))
-
 (match (resolve-module '(fibers internal) #t #f #:ensure #f)
   (#f #t)                                         ;Fibers > 1.0.0
   ((? module? internal)                           ;Fibers <= 1.0.0
@@ -288,7 +276,7 @@ Return a list of jobs that are associated to EVAL-ID."
                                 "evaluate"
                                 (%package-database)
                                 (object->string eval-id))))))
-         (result (match (read/non-blocking port)
+         (result (match (read port)
                    ;; If an error occured during evaluation report it,
                    ;; otherwise, suppose that data read from port are
                    ;; correct and keep things going.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]