all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: 32121@debbugs.gnu.org
Subject: [bug#32121] [PATCH 2/5] utils: Reset the Fiber dynamic environment in %NON-BLOCKING.
Date: Wed, 11 Jul 2018 01:02:44 +0200	[thread overview]
Message-ID: <20180710230247.16639-2-clement@lassieur.org> (raw)
In-Reply-To: <20180710230247.16639-1-clement@lassieur.org>

* src/cuirass/utils.scm (%non-blocking): Wrap body in PARAMETERIZE form that
clears CURRENT-FIBER.

So that PUT-MESSAGE doesn't try to suspend itself within CALL-WITH-NEW-THREAD.
See https://lists.gnu.org/archive/html/guile-devel/2018-07/msg00009.html.
---
 src/cuirass/utils.scm | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/cuirass/utils.scm b/src/cuirass/utils.scm
index bbecfb6..d219a3e 100644
--- a/src/cuirass/utils.scm
+++ b/src/cuirass/utils.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2012, 2013, 2016, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of Cuirass.
 ;;;
@@ -122,22 +123,23 @@ VARS... are bound to the arguments of the critical section."
                               (lambda (vars ...) exp ...)))
 
 (define (%non-blocking thunk)
-  (let ((channel (make-channel)))
-    (call-with-new-thread
-     (lambda ()
-       (catch #t
-         (lambda ()
-           (call-with-values thunk
-             (lambda values
-               (put-message channel `(values ,@values)))))
-         (lambda args
-           (put-message channel `(exception ,@args))))))
-
-    (match (get-message channel)
-      (('values . results)
-       (apply values results))
-      (('exception . args)
-       (apply throw args)))))
+  (parameterize (((@@ (fibers internal) current-fiber) #f))
+    (let ((channel (make-channel)))
+      (call-with-new-thread
+       (lambda ()
+         (catch #t
+           (lambda ()
+             (call-with-values thunk
+               (lambda values
+                 (put-message channel `(values ,@values)))))
+           (lambda args
+             (put-message channel `(exception ,@args))))))
+
+      (match (get-message channel)
+        (('values . results)
+         (apply values results))
+        (('exception . args)
+         (apply throw args))))))
 
 (define-syntax-rule (non-blocking exp ...)
   "Evalaute EXP... in a separate thread so that it doesn't block the execution
-- 
2.18.0

  reply	other threads:[~2018-07-10 23:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 22:58 [bug#32121] Cuirass: add support for multiple inputs Clément Lassieur
2018-07-10 23:02 ` [bug#32121] [PATCH 1/5] base: Compile CHECKOUT in the fiber Clément Lassieur
2018-07-10 23:02   ` Clément Lassieur [this message]
2018-07-13  8:35     ` [bug#32121] [PATCH 2/5] utils: Reset the Fiber dynamic environment in %NON-BLOCKING Ludovic Courtès
2018-07-14 12:13       ` Clément Lassieur
2018-07-14 13:45         ` Ludovic Courtès
2018-07-10 23:02   ` [bug#32121] [PATCH 3/5] database: Add support for database upgrades Clément Lassieur
2018-07-13  8:47     ` Ludovic Courtès
2018-07-14 15:00       ` Clément Lassieur
2018-07-14 15:32     ` Clément Lassieur
2018-07-16 13:17       ` Ludovic Courtès
2018-07-10 23:02   ` [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project' Clément Lassieur
2018-07-13  8:51     ` Ludovic Courtès
2018-07-13  9:35       ` Clément Lassieur
2018-07-13  9:43         ` Clément Lassieur
2018-07-13 11:56         ` Ludovic Courtès
2018-07-14 19:57           ` Clément Lassieur
2018-07-10 23:02   ` [bug#32121] [PATCH 5/5] Add support for multiple inputs Clément Lassieur
2018-07-13  9:28     ` Ludovic Courtès
2018-07-15  8:25       ` Clément Lassieur
2018-07-16 20:13       ` bug#32121: " Clément Lassieur
2018-07-13  8:32   ` [bug#32121] [PATCH 1/5] base: Compile CHECKOUT in the fiber Ludovic Courtès
2018-07-13  8:55     ` Clément Lassieur
2018-07-13 11:50       ` Ludovic Courtès
2018-07-13 11:57         ` Clément Lassieur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180710230247.16639-2-clement@lassieur.org \
    --to=clement@lassieur.org \
    --cc=32121@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.